Merge "Allow tox to support regexes for unit tests"

This commit is contained in:
Zuul 2018-10-27 04:30:23 +00:00 committed by Gerrit Code Review
commit 77201c4f33
3 changed files with 22 additions and 2 deletions

View File

@ -124,6 +124,17 @@ All Pegleg tests are nested under ``tests``.
Pegleg comes equipped with a number of `tox`_ targets for running unit tests,
as well as `pep8`_ and `Bandit`_ checks.
Unit Tests
----------
To run all unit tests, execute::
$ tox -epy35
To run unit tests using a regex, execute::
$ tox -epy35 -- <regex>
.. _Airship: https://airshipit.readthedocs.io
.. _Deckhand: https://airship-deckhand.readthedocs.io/
.. _Airship coding conventions: https://airshipit.readthedocs.io/en/latest/conventions.html

10
tools/gate/run-unit-tests.sh Executable file
View File

@ -0,0 +1,10 @@
#!/usr/bin/env bash
set -e
posargs=$@
if [ ${#posargs} -ge 1 ]; then
pytest -k ${posargs}
else
pytest
fi
set +e

View File

@ -18,8 +18,7 @@ whitelist_externals =
find
commands =
find . -type f -name "*.pyc" -delete
pytest \
{posargs}
{toxinidir}/tools/gate/run-unit-tests.sh '{posargs}'
[testenv:fmt]
basepython=python3