Make --debug flag on run_tests and run_tempest use testtools.run
This commit changes the --debug flag on run_tests.sh and run_tempest.sh
so that instead of setting set +o xtrace will run tests with testools.run.
This enables pdb to work because calling subunit.run or using testr will
interfere with pdb.
Change-Id: I9953af7a2375a1d26df69559799be3df973756af
diff --git a/run_tempest.sh b/run_tempest.sh
index be9b38a..f6c330d 100755
--- a/run_tempest.sh
+++ b/run_tempest.sh
@@ -13,7 +13,7 @@
echo " -t, --serial Run testr serially"
echo " -C, --config Config file location"
echo " -h, --help Print this usage message"
- echo " -d, --debug Debug this script -- set -o xtrace"
+ echo " -d, --debug Run tests with testtools instead of testr. This allows you to use PDB"
echo " -l, --logging Enable logging"
echo " -L, --logging-config Logging config file location. Default is etc/logging.conf"
echo " -- [TESTROPTIONS] After the first '--' you can pass arbitrary arguments to testr "
@@ -26,6 +26,7 @@
always_venv=0
never_venv=0
no_site_packages=0
+debug=0
force=0
wrapper=""
config_file=""
@@ -50,7 +51,7 @@
-n|--no-site-packages) no_site_packages=1;;
-f|--force) force=1;;
-u|--update) update=1;;
- -d|--debug) set -o xtrace;;
+ -d|--debug) debug=1;;
-C|--config) config_file=$2; shift;;
-s|--smoke) testrargs+="smoke"; noseargs+="--attr=type=smoke";;
-t|--serial) serial=1;;
@@ -94,6 +95,14 @@
testr_init
${wrapper} find . -type f -name "*.pyc" -delete
export OS_TEST_PATH=./tempest/test_discover
+ if [ $debug -eq 1 ]; then
+ if [ "$testrargs" = "" ]; then
+ testrargs="discover ./tempest/test_discover"
+ fi
+ ${wrapper} python -m testtools.run $testrargs
+ return $?
+ fi
+
if [ $serial -eq 1 ]; then
${wrapper} testr run --subunit $testrargs | ${wrapper} subunit-2to1 | ${wrapper} tools/colorizer.py
else
diff --git a/run_tests.sh b/run_tests.sh
index 3f00453..eaa7fd7 100755
--- a/run_tests.sh
+++ b/run_tests.sh
@@ -13,7 +13,7 @@
echo " -p, --pep8 Just run pep8"
echo " -c, --coverage Generate coverage report"
echo " -h, --help Print this usage message"
- echo " -d, --debug Debug this script -- set -o xtrace"
+ echo " -d, --debug Run tests with testtools instead of testr. This allows you to use PDB"
echo " -- [TESTROPTIONS] After the first '--' you can pass arbitrary arguments to testr "
}
@@ -25,6 +25,7 @@
always_venv=0
never_venv=0
no_site_packages=0
+debug=0
force=0
coverage=0
wrapper=""
@@ -48,7 +49,7 @@
-n|--no-site-packages) no_site_packages=1;;
-f|--force) force=1;;
-u|--update) update=1;;
- -d|--debug) set -o xtrace;;
+ -d|--debug) debug=1;;
-p|--pep8) let just_pep8=1;;
-c|--coverage) coverage=1;;
-t|--serial) serial=1;;
@@ -75,6 +76,14 @@
testr_init
${wrapper} find . -type f -name "*.pyc" -delete
export OS_TEST_PATH=./tempest/tests
+ if [ $debug -eq 1 ]; then
+ if [ "$testrargs" = "" ]; then
+ testrargs="discover ./tempest/tests"
+ fi
+ ${wrapper} python -m testtools.run $testrargs
+ return $?
+ fi
+
if [ $serial -eq 1 ]; then
${wrapper} testr run --subunit $testrargs | ${wrapper} subunit-2to1 | ${wrapper} tools/colorizer.py
else