Add debug option to run_tests.sh
Change-Id: Ie21cb8b7a370d5e62c7ac75d37affd62f761765a
This commit is contained in:
parent
499ef45720
commit
dc4d670e10
21
run_tests.sh
21
run_tests.sh
@ -14,6 +14,7 @@ function usage {
|
|||||||
echo " -p, --pep8 Run pep8 tests"
|
echo " -p, --pep8 Run pep8 tests"
|
||||||
echo " --all Run pep8 and unit tests"
|
echo " --all Run pep8 and unit tests"
|
||||||
echo " -c, --coverage Generate coverage report"
|
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 " -h, --help Print this usage message"
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
@ -29,6 +30,7 @@ function process_option {
|
|||||||
-p|--pep8) test_pep8=1;;
|
-p|--pep8) test_pep8=1;;
|
||||||
--all) test_unit=1; test_pep8=1;;
|
--all) test_unit=1; test_pep8=1;;
|
||||||
-c|--coverage) coverage=1;;
|
-c|--coverage) coverage=1;;
|
||||||
|
-d|--debug) debug=1;;
|
||||||
-h|--help) usage;;
|
-h|--help) usage;;
|
||||||
*) args="$args $1"; test_unit=1;;
|
*) args="$args $1"; test_unit=1;;
|
||||||
esac
|
esac
|
||||||
@ -37,11 +39,28 @@ function process_option {
|
|||||||
venv=.venv
|
venv=.venv
|
||||||
with_venv=tools/with_venv.sh
|
with_venv=tools/with_venv.sh
|
||||||
wrapper=""
|
wrapper=""
|
||||||
|
debug=0
|
||||||
|
|
||||||
function run_tests {
|
function run_tests {
|
||||||
echo 'Running tests'
|
echo 'Running tests'
|
||||||
# Remove any extraneous DB migrations
|
# Remove any extraneous DB migrations
|
||||||
find heat/db/sqlalchemy/migrate_repo/versions/ -name '*.pyc' -delete
|
find heat/db/sqlalchemy/migrate_repo/versions/ -name '*.pyc' -delete
|
||||||
|
|
||||||
|
if [ $debug -eq 1 ]; then
|
||||||
|
echo "Debugging..."
|
||||||
|
if [ "$args" = "" ]; then
|
||||||
|
# Default to running all tests if specific test is not
|
||||||
|
# provided.
|
||||||
|
testrargs="discover ./heat/tests"
|
||||||
|
fi
|
||||||
|
${wrapper} python -m testtools.run $args $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
|
||||||
|
|
||||||
# Just run the test suites in current environment
|
# Just run the test suites in current environment
|
||||||
if [ -n "$args" ] ; then
|
if [ -n "$args" ] ; then
|
||||||
args="-t $args"
|
args="-t $args"
|
||||||
@ -84,7 +103,7 @@ fi
|
|||||||
result=0
|
result=0
|
||||||
|
|
||||||
# If functional or unit tests have been selected, run them
|
# If functional or unit tests have been selected, run them
|
||||||
if [ "$test_unit" == 1 ] ; then
|
if [ "$test_unit" == 1 ] || [ "$debug" == 1 ] ; then
|
||||||
run_tests
|
run_tests
|
||||||
result=$?
|
result=$?
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user