mirror of
https://github.com/django/django.git
synced 2025-10-24 14:16:09 +00:00
Fixed #3253 -- Exposed the number of failed tests as a return code in manage.py and runtests.py.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4608 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -63,6 +63,8 @@ def run_tests(module_list, verbosity=1, extra_tests=[]):
|
||||
looking for doctests and unittests in models.py or tests.py within
|
||||
the module. A list of 'extra' tests may also be provided; these tests
|
||||
will be added to the test suite.
|
||||
|
||||
Returns the number of tests that failed.
|
||||
"""
|
||||
setup_test_environment()
|
||||
|
||||
@@ -77,7 +79,10 @@ def run_tests(module_list, verbosity=1, extra_tests=[]):
|
||||
|
||||
old_name = settings.DATABASE_NAME
|
||||
create_test_db(verbosity)
|
||||
unittest.TextTestRunner(verbosity=verbosity).run(suite)
|
||||
result = unittest.TextTestRunner(verbosity=verbosity).run(suite)
|
||||
destroy_test_db(old_name, verbosity)
|
||||
|
||||
teardown_test_environment()
|
||||
|
||||
return len(result.failures)
|
||||
|
||||
Reference in New Issue
Block a user