Merge "Debug env for tox"
This commit is contained in:
commit
9b2613acf3
@ -68,12 +68,14 @@ run through tox_.
|
|||||||
|
|
||||||
$ tox -e py27 -- api.v2
|
$ tox -e py27 -- api.v2
|
||||||
|
|
||||||
To debug tests (ie. break into pdb debugger), you can use ''venv'' command::
|
To debug tests (ie. break into pdb debugger), you can use ''debug'' tox
|
||||||
|
environment. Here's an example, passing the name of a test since you'll
|
||||||
|
normally only want to run the test that hits your breakpoint::
|
||||||
|
|
||||||
$ tox -e venv "python -m unittest discover ceilometer"
|
$ tox -e debug ceilometer.tests.test_bin
|
||||||
|
|
||||||
Unfortunately, debugging currently has some limitations:
|
For reference, the ``debug`` tox environment implements the instructions
|
||||||
You cannot run a specific test, you have to launch the whole test suite.
|
here: https://wiki.openstack.org/wiki/Testr#Debugging_.28pdb.29_Tests
|
||||||
|
|
||||||
.. seealso::
|
.. seealso::
|
||||||
|
|
||||||
|
17
tools/debug_helper.sh
Executable file
17
tools/debug_helper.sh
Executable file
@ -0,0 +1,17 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
TMP_DIR=`mktemp -d` || exit 1
|
||||||
|
trap "rm -rf $TMP_DIR" EXIT
|
||||||
|
|
||||||
|
ALL_TESTS=$TMP_DIR/all_tests
|
||||||
|
TESTS_TO_RUN=$TMP_DIR/ks_to_run
|
||||||
|
|
||||||
|
python -m testtools.run discover -t ./ ./ceilometer/tests --list > $ALL_TESTS
|
||||||
|
|
||||||
|
if [ "$1" ]; then
|
||||||
|
grep "$1" < $ALL_TESTS > $TESTS_TO_RUN
|
||||||
|
else
|
||||||
|
mv $ALL_TESTS $TESTS_TO_RUN
|
||||||
|
fi
|
||||||
|
|
||||||
|
STANDARD_THREADS=1 python -m testtools.run discover --load-list $TESTS_TO_RUN
|
4
tox.ini
4
tox.ini
@ -41,6 +41,10 @@ commands = python setup.py build_sphinx
|
|||||||
[testenv:venv]
|
[testenv:venv]
|
||||||
commands = {posargs}
|
commands = {posargs}
|
||||||
|
|
||||||
|
[testenv:debug]
|
||||||
|
commands =
|
||||||
|
bash -x {toxinidir}/setup-test-env.sh {toxinidir}/tools/debug_helper.sh {posargs}
|
||||||
|
|
||||||
[flake8]
|
[flake8]
|
||||||
# H305 imports not grouped correctly
|
# H305 imports not grouped correctly
|
||||||
ignore = H305
|
ignore = H305
|
||||||
|
Loading…
x
Reference in New Issue
Block a user