diff --git a/django/test/runner.py b/django/test/runner.py
index 84fe249..e1a6863 100644
|
a
|
b
|
class DiscoverRunner(object):
|
| 14 | 14 | A Django test runner that uses unittest2 test discovery. |
| 15 | 15 | """ |
| 16 | 16 | |
| | 17 | suite_class = TestSuite |
| | 18 | test_runner = unittest.TextTestRunner |
| 17 | 19 | test_loader = defaultTestLoader |
| 18 | 20 | reorder_by = (TestCase, ) |
| 19 | 21 | option_list = ( |
| … |
… |
class DiscoverRunner(object):
|
| 42 | 44 | unittest.installHandler() |
| 43 | 45 | |
| 44 | 46 | def build_suite(self, test_labels=None, extra_tests=None, **kwargs): |
| 45 | | suite = TestSuite() |
| | 47 | suite = self.suite_class() |
| 46 | 48 | test_labels = test_labels or ['.'] |
| 47 | 49 | extra_tests = extra_tests or [] |
| 48 | 50 | |
| … |
… |
class DiscoverRunner(object):
|
| 107 | 109 | return setup_databases(self.verbosity, self.interactive, **kwargs) |
| 108 | 110 | |
| 109 | 111 | def run_suite(self, suite, **kwargs): |
| 110 | | return unittest.TextTestRunner( |
| | 112 | return self.test_runner( |
| 111 | 113 | verbosity=self.verbosity, |
| 112 | 114 | failfast=self.failfast, |
| 113 | 115 | ).run(suite) |
| … |
… |
def reorder_suite(suite, classes):
|
| 201 | 203 | classes[1], etc. Tests with no match in classes are placed last. |
| 202 | 204 | """ |
| 203 | 205 | class_count = len(classes) |
| 204 | | bins = [unittest.TestSuite() for i in range(class_count+1)] |
| | 206 | suite_class = type(suite) |
| | 207 | bins = [suite_class() for i in range(class_count+1)] |
| 205 | 208 | partition_suite(suite, classes, bins) |
| 206 | 209 | for i in range(class_count): |
| 207 | 210 | bins[0].addTests(bins[i+1]) |
diff --git a/docs/topics/testing/advanced.txt b/docs/topics/testing/advanced.txt
index d8d59c6..0adde3e 100644
|
a
|
b
|
set up, execute and tear down the test suite.
|
| 339 | 339 | Attributes |
| 340 | 340 | ~~~~~~~~~~ |
| 341 | 341 | |
| | 342 | .. attribute:: DicsoverRunner.suite_class |
| | 343 | |
| | 344 | The class used to build the test suite. By default it is set to |
| | 345 | ``unittest.TestSuite``. This can be overridden if you wish to implement |
| | 346 | different logic for collecting tests into a test suite. |
| | 347 | |
| | 348 | .. attribute:: DiscoverRunner.test_runner |
| | 349 | |
| | 350 | This is the class of the low-level test runner which is used to execute |
| | 351 | the individual tests and format the results. By default it is set to |
| | 352 | ``unittest.TextTestRunner``. Despite the unfortunate similarity in |
| | 353 | naming conventions, this is not the same type of class as |
| | 354 | ``DiscoverRunner``, which covers a broader set of responsibilites. You |
| | 355 | can override this attribute to modify the way tests are run and reported. |
| | 356 | |
| | 357 | .. attribute:: DiscoverRunner.test_loader |
| | 358 | |
| | 359 | This is the class that loads tests, whether from TestCases or modules or |
| | 360 | otherwise and bundles them into test suites for the runner to execute. |
| | 361 | By default it is set to ``unittest.defaultTestLoader``. You can override |
| | 362 | this attribute if your tests are going to be loaded in unusual ways. |
| | 363 | |
| 342 | 364 | .. attribute:: DiscoverRunner.option_list |
| 343 | 365 | |
| 344 | 366 | This is the tuple of ``optparse`` options which will be fed into the |