Debug env for tox
Running a test with pdb was difficult because testr captures output and causes pdb prompt to quit. Tips for how to run with debug are provided here: https://wiki.openstack.org/wiki/Testr#Debugging_.28pdb.29_Tests This change puts these commands into a debug env in tox.ini so you can do a command like tox -e debug test_v3_trust_token_get_token_fails or, for more granularity: tox -e debug keystone.tests.test_sql_migrate_extensions.EndpointFilterExtension tox -e debug keystone.tests.test_sql_migrate_extensions.EndpointFilterExtension.test_downgrade and when it hits your breakpoint you'll get the debug prompt. Change-Id: I2b5dc81f4652dc89ecbcc7c785245a81cf77a1ca
This commit is contained in:
parent
6c7f00d459
commit
c8302509e6
18
tools/debug_helper.sh
Executable file
18
tools/debug_helper.sh
Executable file
@ -0,0 +1,18 @@
|
|||||||
|
#!/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 ./ ./keystone/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
|
5
tox.ini
5
tox.ini
@ -27,6 +27,11 @@ commands = python setup.py testr --coverage --testr-args='{posargs}'
|
|||||||
[testenv:venv]
|
[testenv:venv]
|
||||||
commands = {posargs}
|
commands = {posargs}
|
||||||
|
|
||||||
|
[testenv:debug]
|
||||||
|
|
||||||
|
commands =
|
||||||
|
{toxinidir}/tools/debug_helper.sh {posargs}
|
||||||
|
|
||||||
[flake8]
|
[flake8]
|
||||||
filename= *.py,keystone-*
|
filename= *.py,keystone-*
|
||||||
show-source = true
|
show-source = true
|
||||||
|
Loading…
Reference in New Issue
Block a user