Ticket #15675: ticket15675.patch

File ticket15675.patch, 2.3 KB (added by msiedlarek, 14 years ago)

Patch

  • django/core/management/commands/test.py

    diff --git a/django/core/management/commands/test.py b/django/core/management/commands/test.py
    index 1431f00..c400a78 100644
    a b  
    11from django.core.management.base import BaseCommand
     2from django.test.utils import get_runner
     3from django.conf import settings
    24from optparse import make_option
    35import sys
    46
     7TestRunner = get_runner(settings)
     8
    59class Command(BaseCommand):
    610    option_list = BaseCommand.option_list + (
    711        make_option('--noinput', action='store_false', dest='interactive', default=True,
    812            help='Tells Django to NOT prompt the user for input of any kind.'),
    913        make_option('--failfast', action='store_true', dest='failfast', default=False,
    1014            help='Tells Django to stop running the test suite after first failed test.')
    11     )
     15    ) + getattr(TestRunner, 'option_list', ())
    1216    help = 'Runs the test suite for the specified applications, or the entire site if no apps are specified.'
    1317    args = '[appname ...]'
    1418
    1519    requires_model_validation = False
    1620
    1721    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)
    2525
    2626        if hasattr(TestRunner, 'func_name'):
    2727            # Pre 1.2 test runners were just functions,
    class Command(BaseCommand):  
    3131                'Function-based test runners are deprecated. Test runners should be classes with a run_tests() method.',
    3232                DeprecationWarning
    3333            )
    34             failures = TestRunner(test_labels, verbosity=verbosity, interactive=interactive)
     34            failures = TestRunner(test_labels, **options)
    3535        else:
    36             test_runner = TestRunner(verbosity=verbosity, interactive=interactive, failfast=failfast)
     36            test_runner = TestRunner(**options)
    3737            failures = test_runner.run_tests(test_labels)
    3838
    3939        if failures:
Back to Top