diff --git a/django/core/management/commands/test.py b/django/core/management/commands/test.py
index 1431f00..c400a78 100644
a
|
b
|
|
1 | 1 | from django.core.management.base import BaseCommand |
| 2 | from django.test.utils import get_runner |
| 3 | from django.conf import settings |
2 | 4 | from optparse import make_option |
3 | 5 | import sys |
4 | 6 | |
| 7 | TestRunner = get_runner(settings) |
| 8 | |
5 | 9 | class Command(BaseCommand): |
6 | 10 | option_list = BaseCommand.option_list + ( |
7 | 11 | make_option('--noinput', action='store_false', dest='interactive', default=True, |
8 | 12 | help='Tells Django to NOT prompt the user for input of any kind.'), |
9 | 13 | make_option('--failfast', action='store_true', dest='failfast', default=False, |
10 | 14 | help='Tells Django to stop running the test suite after first failed test.') |
11 | | ) |
| 15 | ) + getattr(TestRunner, 'option_list', ()) |
12 | 16 | help = 'Runs the test suite for the specified applications, or the entire site if no apps are specified.' |
13 | 17 | args = '[appname ...]' |
14 | 18 | |
15 | 19 | requires_model_validation = False |
16 | 20 | |
17 | 21 | def handle(self, *test_labels, **options): |
18 | | from django.conf import settings |
19 | | from django.test.utils import get_runner |
20 | | |
21 | | verbosity = int(options.get('verbosity', 1)) |
22 | | interactive = options.get('interactive', True) |
23 | | failfast = options.get('failfast', False) |
24 | | TestRunner = get_runner(settings) |
| 22 | options['verbosity'] = int(options.get('verbosity', 1)) |
| 23 | options.setdefault('interactive', True) |
| 24 | options.setdefault('failfast', False) |
25 | 25 | |
26 | 26 | if hasattr(TestRunner, 'func_name'): |
27 | 27 | # Pre 1.2 test runners were just functions, |
… |
… |
class Command(BaseCommand):
|
31 | 31 | 'Function-based test runners are deprecated. Test runners should be classes with a run_tests() method.', |
32 | 32 | DeprecationWarning |
33 | 33 | ) |
34 | | failures = TestRunner(test_labels, verbosity=verbosity, interactive=interactive) |
| 34 | failures = TestRunner(test_labels, **options) |
35 | 35 | else: |
36 | | test_runner = TestRunner(verbosity=verbosity, interactive=interactive, failfast=failfast) |
| 36 | test_runner = TestRunner(**options) |
37 | 37 | failures = test_runner.run_tests(test_labels) |
38 | 38 | |
39 | 39 | if failures: |