Browse Source

Merge "Allow tox to support regexes for unit tests"

Zuul 5 months ago
parent
commit
77201c4f33
3 changed files with 22 additions and 2 deletions
  1. 11
    0
      doc/source/developer-overview.rst
  2. 10
    0
      tools/gate/run-unit-tests.sh
  3. 1
    2
      tox.ini

+ 11
- 0
doc/source/developer-overview.rst View File

@@ -124,6 +124,17 @@ All Pegleg tests are nested under ``tests``.
124 124
 Pegleg comes equipped with a number of `tox`_ targets for running unit tests,
125 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 138
 .. _Airship: https://airshipit.readthedocs.io
128 139
 .. _Deckhand: https://airship-deckhand.readthedocs.io/
129 140
 .. _Airship coding conventions: https://airshipit.readthedocs.io/en/latest/conventions.html

+ 10
- 0
tools/gate/run-unit-tests.sh View File

@@ -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

+ 1
- 2
tox.ini View File

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

Loading…
Cancel
Save