From 75443cd014d49c2eceb93a6bdedddbf2ab6cfbc9 Mon Sep 17 00:00:00 2001 From: Eric Davis Date: Sat, 17 Sep 2011 11:26:19 -0700 Subject: [PATCH] Properly set the exit code when running tests run_tests returns the number of failed tests. Supplying this number to sys.exit lets other programs know if there were any test failures. Also, run the tests with the default verbosity. --- analytical/tests/utils.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/analytical/tests/utils.py b/analytical/tests/utils.py index 5972674..8b0dd29 100644 --- a/analytical/tests/utils.py +++ b/analytical/tests/utils.py @@ -105,10 +105,13 @@ class override_settings(object): def run_tests(): """ Use the Django test runner to run the tests. + + Sets the return code to the number of failed tests. """ + import sys from django.test.simple import DjangoTestSuiteRunner - runner = DjangoTestSuiteRunner(verbosity=2) - runner.run_tests(None) + runner = DjangoTestSuiteRunner() + sys.exit(runner.run_tests(["analytical"])) def with_apps(*apps):