diff options
author | Zuul <zuul@review.openstack.org> | 2018-10-27 04:30:23 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2018-10-27 04:30:24 +0000 |
commit | 77201c4f337688d2a40a608de4e7356b2891f4f2 (patch) | |
tree | f552f135903e709eaf35455f01736341af4e65e1 | |
parent | 49abff1be3fa73cda725773425323f6d6627d155 (diff) | |
parent | ec34ed056f2020cb87d605dacedc2253b34133ef (diff) |
Merge "Allow tox to support regexes for unit tests"
-rw-r--r-- | doc/source/developer-overview.rst | 11 | ||||
-rwxr-xr-x | tools/gate/run-unit-tests.sh | 10 | ||||
-rw-r--r-- | tox.ini | 3 |
3 files changed, 22 insertions, 2 deletions
diff --git a/doc/source/developer-overview.rst b/doc/source/developer-overview.rst index 1e69df9..c4c2671 100644 --- a/doc/source/developer-overview.rst +++ b/doc/source/developer-overview.rst | |||
@@ -124,6 +124,17 @@ All Pegleg tests are nested under ``tests``. | |||
124 | Pegleg comes equipped with a number of `tox`_ targets for running unit tests, | 124 | Pegleg comes equipped with a number of `tox`_ targets for running unit tests, |
125 | as well as `pep8`_ and `Bandit`_ checks. | 125 | as well as `pep8`_ and `Bandit`_ checks. |
126 | 126 | ||
127 | Unit Tests | ||
128 | ---------- | ||
129 | |||
130 | To run all unit tests, execute:: | ||
131 | |||
132 | $ tox -epy35 | ||
133 | |||
134 | To run unit tests using a regex, execute:: | ||
135 | |||
136 | $ tox -epy35 -- <regex> | ||
137 | |||
127 | .. _Airship: https://airshipit.readthedocs.io | 138 | .. _Airship: https://airshipit.readthedocs.io |
128 | .. _Deckhand: https://airship-deckhand.readthedocs.io/ | 139 | .. _Deckhand: https://airship-deckhand.readthedocs.io/ |
129 | .. _Airship coding conventions: https://airshipit.readthedocs.io/en/latest/conventions.html | 140 | .. _Airship coding conventions: https://airshipit.readthedocs.io/en/latest/conventions.html |
diff --git a/tools/gate/run-unit-tests.sh b/tools/gate/run-unit-tests.sh new file mode 100755 index 0000000..15042fe --- /dev/null +++ b/tools/gate/run-unit-tests.sh | |||
@@ -0,0 +1,10 @@ | |||
1 | #!/usr/bin/env bash | ||
2 | |||
3 | set -e | ||
4 | posargs=$@ | ||
5 | if [ ${#posargs} -ge 1 ]; then | ||
6 | pytest -k ${posargs} | ||
7 | else | ||
8 | pytest | ||
9 | fi | ||
10 | set +e | ||
@@ -18,8 +18,7 @@ whitelist_externals = | |||
18 | find | 18 | find |
19 | commands = | 19 | commands = |
20 | find . -type f -name "*.pyc" -delete | 20 | find . -type f -name "*.pyc" -delete |
21 | pytest \ | 21 | {toxinidir}/tools/gate/run-unit-tests.sh '{posargs}' |
22 | {posargs} | ||
23 | 22 | ||
24 | [testenv:fmt] | 23 | [testenv:fmt] |
25 | basepython=python3 | 24 | basepython=python3 |