mirror of
https://github.com/django/django.git
synced 2025-08-03 10:34:04 +00:00
Fixed #12624 -- Modified test runners to be class based.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12255 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
34e420184c
commit
53b61d9c02
7 changed files with 216 additions and 82 deletions
|
@ -156,11 +156,23 @@ def django_tests(verbosity, interactive, failfast, test_labels):
|
|||
# Run the test suite, including the extra validation tests.
|
||||
from django.test.utils import get_runner
|
||||
if not hasattr(settings, 'TEST_RUNNER'):
|
||||
settings.TEST_RUNNER = 'django.test.simple.run_tests'
|
||||
test_runner = get_runner(settings)
|
||||
settings.TEST_RUNNER = 'django.test.simple.DjangoTestSuiteRunner'
|
||||
TestRunner = get_runner(settings)
|
||||
|
||||
if hasattr(TestRunner, 'func_name'):
|
||||
# Pre 1.2 test runners were just functions,
|
||||
# and did not support the 'failfast' option.
|
||||
import warnings
|
||||
warnings.warn(
|
||||
'Function-based test runners are deprecated. Test runners should be classes with a run_tests() method.',
|
||||
PendingDeprecationWarning
|
||||
)
|
||||
failures = TestRunner(test_labels, verbosity=verbosity, interactive=interactive,
|
||||
extra_tests=extra_tests)
|
||||
else:
|
||||
test_runner = TestRunner(verbosity=verbosity, interactive=interactive, failfast=failfast)
|
||||
failures = test_runner.run_tests(test_labels, extra_tests=extra_tests)
|
||||
|
||||
failures = test_runner(test_labels, verbosity=verbosity, interactive=interactive, failfast=failfast,
|
||||
extra_tests=extra_tests)
|
||||
if failures:
|
||||
sys.exit(bool(failures))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue