diff --git a/django/core/management/commands/test.py b/django/core/management/commands/test.py
index 73796fe..2cafa40 100644
|
a
|
b
|
class Command(BaseCommand):
|
| 52 | 52 | 'with LiveServerTestCase) is expected to run from. The ' |
| 53 | 53 | 'default value is localhost:8081-8179.', |
| 54 | 54 | ) |
| 55 | | |
| | 55 | parser.add_argument( |
| | 56 | '--method-filter', dest='methodfilter', |
| | 57 | action='store', default=None, |
| | 58 | help='csv list of test methods to run out of the TestSuite created, discard the others.' |
| | 59 | ) |
| 56 | 60 | test_runner_class = get_runner(settings, self.test_runner) |
| 57 | 61 | |
| 58 | 62 | if hasattr(test_runner_class, 'add_arguments'): |
| … |
… |
class Command(BaseCommand):
|
| 69 | 73 | del options['liveserver'] |
| 70 | 74 | |
| 71 | 75 | test_runner = TestRunner(**options) |
| 72 | | failures = test_runner.run_tests(test_labels) |
| | 76 | failures = test_runner.run_tests(test_labels, method_filter=options.get('methodfilter')) |
| 73 | 77 | |
| 74 | 78 | if failures: |
| 75 | 79 | sys.exit(bool(failures)) |
diff --git a/django/test/runner.py b/django/test/runner.py
index c60f5e8..310ce1e 100644
|
a
|
b
|
class DebugSQLTextTestResult(unittest.TextTestResult):
|
| 63 | 63 | self.stream.writeln("%s" % sql_debug) |
| 64 | 64 | |
| 65 | 65 | |
| | 66 | class SimpleTextTestResult(DebugSQLTextTestResult): |
| | 67 | def __init__(self, stream, descriptions, verbosity): |
| | 68 | super(SimpleTextTestResult, self).__init__(stream, descriptions, verbosity) |
| | 69 | |
| | 70 | def printErrorList(self, flavour, errors): |
| | 71 | for test, err, sql in errors: |
| | 72 | self.stream.writeln(self.separator1) |
| | 73 | self.stream.writeln("%s: %s" % (flavour, self.getDescription(test))) |
| | 74 | self.stream.writeln("Path: %s" % test.id()) |
| | 75 | self.stream.writeln(self.separator1) |
| | 76 | self.stream.writeln("%s" % err) |
| | 77 | |
| | 78 | |
| 66 | 79 | class RemoteTestResult(object): |
| 67 | 80 | """ |
| 68 | 81 | Record information about which tests have succeeded and which have failed. |
| … |
… |
class DiscoverRunner(object):
|
| 500 | 513 | ) |
| 501 | 514 | |
| 502 | 515 | def get_resultclass(self): |
| 503 | | return DebugSQLTextTestResult if self.debug_sql else None |
| | 516 | return DebugSQLTextTestResult if self.debug_sql else SimpleTextTestResult |
| 504 | 517 | |
| 505 | 518 | def run_suite(self, suite, **kwargs): |
| 506 | 519 | resultclass = self.get_resultclass() |
| … |
… |
class DiscoverRunner(object):
|
| 546 | 559 | """ |
| 547 | 560 | self.setup_test_environment() |
| 548 | 561 | suite = self.build_suite(test_labels, extra_tests) |
| | 562 | if kwargs.get('method_filter'): |
| | 563 | only_these_methods = kwargs.get('method_filter').split(',') |
| | 564 | new_suite = unittest.TestSuite() |
| | 565 | for t in suite: |
| | 566 | if t._testMethodName in only_these_methods: |
| | 567 | new_suite.addTest(t) |
| | 568 | suite = new_suite |
| | 569 | del new_suite |
| 549 | 570 | old_config = self.setup_databases() |
| 550 | 571 | result = self.run_suite(suite) |
| 551 | 572 | self.teardown_databases(old_config) |