summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.openstack.org>2018-10-27 04:30:23 +0000
committerGerrit Code Review <review@openstack.org>2018-10-27 04:30:24 +0000
commit77201c4f337688d2a40a608de4e7356b2891f4f2 (patch)
treef552f135903e709eaf35455f01736341af4e65e1
parent49abff1be3fa73cda725773425323f6d6627d155 (diff)
parentec34ed056f2020cb87d605dacedc2253b34133ef (diff)
Merge "Allow tox to support regexes for unit tests"
-rw-r--r--doc/source/developer-overview.rst11
-rwxr-xr-xtools/gate/run-unit-tests.sh10
-rw-r--r--tox.ini3
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``.
124Pegleg comes equipped with a number of `tox`_ targets for running unit tests, 124Pegleg comes equipped with a number of `tox`_ targets for running unit tests,
125as well as `pep8`_ and `Bandit`_ checks. 125as well as `pep8`_ and `Bandit`_ checks.
126 126
127Unit Tests
128----------
129
130To run all unit tests, execute::
131
132 $ tox -epy35
133
134To 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
3set -e
4posargs=$@
5if [ ${#posargs} -ge 1 ]; then
6 pytest -k ${posargs}
7else
8 pytest
9fi
10set +e
diff --git a/tox.ini b/tox.ini
index da840ed..c4db8da 100644
--- a/tox.ini
+++ b/tox.ini
@@ -18,8 +18,7 @@ whitelist_externals =
18 find 18 find
19commands = 19commands =
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]
25basepython=python3 24basepython=python3