Enable debug in run_tests using pdb
When you try to debug some test using nose.tools.set_trace the pdb prompt is 'trapped' inside tee manipulation of stdout. Since debug mode is not supposed to be used in the gates we don't need to concern about the lack of a log to analyze the output. Change-Id: I7daebe7267b04d41f2ca383f826419f0dfb544ab
This commit is contained in:
parent
284d11c559
commit
48f43fd4e9
@ -18,6 +18,7 @@ function usage {
|
|||||||
echo " -c, --coverage Generate coverage report"
|
echo " -c, --coverage Generate coverage report"
|
||||||
echo " -h, --help Print this usage message"
|
echo " -h, --help Print this usage message"
|
||||||
echo " -v, --verbose Display nosetests in the console"
|
echo " -v, --verbose Display nosetests in the console"
|
||||||
|
echo " -d, --debug Enable pdb's prompt to be displayed during tests. This will run nosetests with --pdb option"
|
||||||
echo " --hide-elapsed Don't print the elapsed time for each test along with slow test list"
|
echo " --hide-elapsed Don't print the elapsed time for each test along with slow test list"
|
||||||
echo ""
|
echo ""
|
||||||
echo "Note: with no options specified, the script will try to run the tests in a virtual environment,"
|
echo "Note: with no options specified, the script will try to run the tests in a virtual environment,"
|
||||||
@ -40,6 +41,7 @@ function process_option {
|
|||||||
-p|--pep8) just_pep8=1;;
|
-p|--pep8) just_pep8=1;;
|
||||||
-P|--no-pep8) no_pep8=1;;
|
-P|--no-pep8) no_pep8=1;;
|
||||||
-c|--coverage) coverage=1;;
|
-c|--coverage) coverage=1;;
|
||||||
|
-d|--debug) debug=1;;
|
||||||
-v|--verbose) verbose=1;;
|
-v|--verbose) verbose=1;;
|
||||||
-*) noseopts="$noseopts $1";;
|
-*) noseopts="$noseopts $1";;
|
||||||
*) noseargs="$noseargs $1"
|
*) noseargs="$noseargs $1"
|
||||||
@ -62,6 +64,7 @@ coverage=0
|
|||||||
recreate_db=1
|
recreate_db=1
|
||||||
patch_migrate=1
|
patch_migrate=1
|
||||||
verbose=0
|
verbose=0
|
||||||
|
debug=0
|
||||||
|
|
||||||
export NOSE_WITH_OPENSTACK=1
|
export NOSE_WITH_OPENSTACK=1
|
||||||
export NOSE_OPENSTACK_COLOR=1
|
export NOSE_OPENSTACK_COLOR=1
|
||||||
@ -90,6 +93,8 @@ fi
|
|||||||
function run_tests {
|
function run_tests {
|
||||||
# Cleanup *pyc
|
# Cleanup *pyc
|
||||||
${wrapper} find . -type f -name "*.pyc" -delete
|
${wrapper} find . -type f -name "*.pyc" -delete
|
||||||
|
if [ "$debug" -eq 0 ];
|
||||||
|
then
|
||||||
# Just run the test suites in current environment
|
# Just run the test suites in current environment
|
||||||
if [ "$verbose" -eq 1 ];
|
if [ "$verbose" -eq 1 ];
|
||||||
then
|
then
|
||||||
@ -119,6 +124,10 @@ function run_tests {
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
${wrapper} $NOSETESTS --pdb
|
||||||
|
RESULT=$?
|
||||||
|
fi
|
||||||
return $RESULT
|
return $RESULT
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user