diff options
author | Clark Boylan <clark.boylan@gmail.com> | 2013-02-22 15:36:04 -0800 |
---|---|---|
committer | Clark Boylan <clark.boylan@gmail.com> | 2013-02-23 15:02:26 -0800 |
commit | d923921d1277a21d2a80539a72dda4d56d4f36eb (patch) | |
tree | b21b26fbfde20e85290534785ca8384e9f558cb2 /run_tests.sh | |
parent | 5cb6f500d82dcd3a17e4b4ec78fcfc5f6a6e0327 (diff) | |
download | nova-d923921d1277a21d2a80539a72dda4d56d4f36eb.tar.gz |
Readd run_tests.sh --debug option.
Testr doesn't directly support running tests with pdb so the --debug
option was pulled from run_tests.sh during the testr switch. Add the
flag back into run_tests.sh and have it run tests with testtools.run
which allows users to import pdb in tests then run them without
interference from testr.
Example usage:
# First edit test file to import pdb.
run_tests.sh -d path.to.test
If the test is not given on the command line all tests will be run.
Change-Id: I4afca9ca997ccb6c575b714b778a9db8306c7891
Diffstat (limited to 'run_tests.sh')
-rwxr-xr-x | run_tests.sh | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/run_tests.sh b/run_tests.sh index 9872858b42..2b6eda9002 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -16,6 +16,7 @@ function usage { echo " -p, --pep8 Just run PEP8 and HACKING compliance check" echo " -P, --no-pep8 Don't run static code checks" echo " -c, --coverage Generate coverage report" + echo " -d, --debug Run tests with testtools instead of testr. This allows you to use the debugger." echo " -h, --help Print this usage message" echo " --hide-elapsed Don't print the elapsed time for each test along with slow test list" echo " --virtual-env-path <path> Location of the virtualenv directory" @@ -46,6 +47,7 @@ function process_options { -p|--pep8) just_pep8=1;; -P|--no-pep8) no_pep8=1;; -c|--coverage) coverage=1;; + -d|--debug) debug=1;; --virtual-env-path) (( i++ )) venv_path=${!i} @@ -80,6 +82,7 @@ wrapper="" just_pep8=0 no_pep8=0 coverage=0 +debug=0 recreate_db=1 update=0 @@ -109,6 +112,20 @@ function run_tests { # Cleanup *pyc ${wrapper} find . -type f -name "*.pyc" -delete + if [ $debug -eq 1 ]; then + if [ "$testropts" = "" ] && [ "$testrargs" = "" ]; then + # Default to running all tests if specific test is not + # provided. + testrargs="discover ./nova/tests" + fi + ${wrapper} python -m testtools.run $testropts $testrargs + + # Short circuit because all of the testr and coverage stuff + # below does not make sense when running testtools.run for + # debugging purposes. + return $? + fi + if [ $coverage -eq 1 ]; then # Do not test test_coverage_ext when gathering coverage. if [ "x$testrargs" = "x" ]; then |