Add pdb support to tox with debug helper shell script
The Keystone team has been using a home brewed `debug_helper.sh` file to run tests with pdb support, it's now being also used by pycadf too. As noted by bnemec [1] we should move this to oslo. [1] https://bugs.launchpad.net/pycadf/+bug/1354192 To run any test in particular, run tox with -e debug: `tox -e debug` It also supports passing in a specific test module, class or case. The shell file runs testtools underneath the covers to get pdb support. Change-Id: Idb715bc137459a2f6d16ac3f65c718a567df49ff Co-Authored-By: Brant Knudson <bknudson@us.ibm.com>
This commit is contained in:
parent
97464ff560
commit
b371ea2373
@ -22,6 +22,8 @@ classifier =
|
||||
[files]
|
||||
packages =
|
||||
oslotest
|
||||
scripts =
|
||||
tools/oslo_debug_helper.sh
|
||||
|
||||
[global]
|
||||
setup-hooks =
|
||||
|
30
tools/oslo_debug_helper.sh
Executable file
30
tools/oslo_debug_helper.sh
Executable file
@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
|
||||
# To utilize this file, add the following to tox.ini:
|
||||
#[testenv:debug]
|
||||
#commands = oslo_debug_helper.sh {posargs}
|
||||
|
||||
# To run with tox:
|
||||
#tox -e debug
|
||||
#tox -e debug test_notifications
|
||||
#tox -e debug test_notifications.NotificationsTestCase
|
||||
#tox -e debug test_notifications.NotificationsTestCase.test_send_notification
|
||||
|
||||
TMP_DIR=`mktemp -d` || exit 1
|
||||
trap "rm -rf $TMP_DIR" EXIT
|
||||
|
||||
ALL_TESTS=$TMP_DIR/all_tests
|
||||
TESTS_TO_RUN=$TMP_DIR/tests_to_run
|
||||
|
||||
PACKAGENAME=$(python setup.py --name)
|
||||
|
||||
python -m testtools.run discover -t ./ ./$PACKAGENAME/tests --list > $ALL_TESTS
|
||||
|
||||
if [ "$1" ]; then
|
||||
grep "$1" < $ALL_TESTS > $TESTS_TO_RUN
|
||||
else
|
||||
mv $ALL_TESTS $TESTS_TO_RUN
|
||||
fi
|
||||
|
||||
python -m testtools.run discover --load-list $TESTS_TO_RUN
|
||||
|
Loading…
x
Reference in New Issue
Block a user