Skip to content

Commit 599583c

Browse files
committed
add a "fast" environment in tox to exit as soon as any test fails
The default in CI is still to run all of the tests.
1 parent 7cd5da4 commit 599583c

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

docs/source/developers.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,11 @@ Python::
8686

8787
$ tox -e py27 tests/test_cd.sh
8888

89+
To stop the test suite as soon as any test fails, use the `fast` tox
90+
target::
91+
92+
$ tox -e fast
93+
8994
Add new tests by modifying an existing file or creating new script in
9095
the ``tests`` directory.
9196

tests/run_tests

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ then
1414
fi
1515
fi
1616

17+
# Override FAIL_FAST to true to exit as soon as any test fails
18+
FAIL_FAST=${FAIL_FAST:-false}
19+
1720
# Force the tox virtualenv to be active.
1821
#
1922
# Since this script runs from within a separate shell created by tox,
@@ -69,6 +72,9 @@ do
6972
export SHUNIT_PARENT
7073
if ! $SHELL $test_shell_opts $test_script; then
7174
RC=1
75+
if $FAIL_FAST; then
76+
exit $RC
77+
fi
7278
fi
7379
echo
7480

tox.ini

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ allowlist_externals =
1313
zsh
1414
ksh
1515

16+
[testenv:fast]
17+
setenv =
18+
TOXIC = true
19+
SHELL = /bin/bash
20+
FAIL_FAST = true
21+
1622
[testenv:style]
1723
deps = flake8
1824
commands = flake8 virtualenvwrapper docs/source/conf.py

0 commit comments

Comments
 (0)