From 6f562bbe09b06fe541c22ffb2bd4ad7111e7d664 Mon Sep 17 00:00:00 2001 From: Chuck Short Date: Wed, 7 Nov 2012 18:45:03 -0600 Subject: Display errors when running nosetests During Ubuntu builds we run the run_test.sh script during the package build process, so that we can catch regressions in our packaging before uploading to the archive. However a recent change writes the output of the nosetests to an error log so we don't see why the package fail to build. This patch also displays the output of the nosetests so we can see why the tests fail without having to look at the nosetests.log. This patch add the '-v', for a verbose display of nosetests. Change-Id: Id21d53df356de344a8577282c5a82f3ff927bc11 Signed-off-by: Chuck Short --- run_tests.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/run_tests.sh b/run_tests.sh index 5028adb0a..b25178766 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -17,6 +17,7 @@ function usage { echo " -P, --no-pep8 Don't run static code checks" echo " -c, --coverage Generate coverage report" echo " -h, --help Print this usage message" + echo " -v, --verbose Display nosetests in the console" echo " --hide-elapsed Don't print the elapsed time for each test along with slow test list" echo "" echo "Note: with no options specified, the script will try to run the tests in a virtual environment," @@ -39,6 +40,7 @@ function process_option { -p|--pep8) just_pep8=1;; -P|--no-pep8) no_pep8=1;; -c|--coverage) coverage=1;; + -v|--verbose) verbose=1;; -*) noseopts="$noseopts $1";; *) noseargs="$noseargs $1" esac @@ -59,6 +61,7 @@ no_pep8=0 coverage=0 recreate_db=1 patch_migrate=1 +verbose=0 export NOSE_WITH_OPENSTACK=1 export NOSE_OPENSTACK_COLOR=1 @@ -88,7 +91,13 @@ function run_tests { # Cleanup *pyc ${wrapper} find . -type f -name "*.pyc" -delete # Just run the test suites in current environment - ${wrapper} $NOSETESTS | tee nosetests.log + if [ "$verbose" -eq 1 ]; + then + ${wrapper} $NOSETESTS 2>&1 | tee nosetests.log + else + ${wrapper} $NOSETESTS | tee nosetests.log + fi + # If we get some short import error right away, print the error log directly RESULT=$? if [ "$RESULT" -ne "0" ]; -- cgit