Code

Ticket #16534: djangotestsuiterunner.diff

File djangotestsuiterunner.diff, 1.3 KB (added by tomchristie, 3 years ago)
Line 
1diff --git a/django/test/simple.py b/django/test/simple.py
2index c9adfd2..acf8764 100644
3--- a/django/test/simple.py
4+++ b/django/test/simple.py
5@@ -220,7 +220,12 @@ def dependency_ordered(test_databases, dependencies):
6         test_databases = deferred
7     return ordered_test_databases
8 
9+
10+
11 class DjangoTestSuiteRunner(object):
12+    suiteclass = unittest.TestSuite
13+    runnerclass = unittest.TextTestRunner
14+
15     def __init__(self, verbosity=1, interactive=True, failfast=True, **kwargs):
16         self.verbosity = verbosity
17         self.interactive = interactive
18@@ -232,7 +237,7 @@ class DjangoTestSuiteRunner(object):
19         unittest.installHandler()
20 
21     def build_suite(self, test_labels, extra_tests=None, **kwargs):
22-        suite = unittest.TestSuite()
23+        suite = self.suiteclass()
24 
25         if test_labels:
26             for label in test_labels:
27@@ -308,7 +313,7 @@ class DjangoTestSuiteRunner(object):
28         return old_names, mirrors
29 
30     def run_suite(self, suite, **kwargs):
31-        return unittest.TextTestRunner(verbosity=self.verbosity, failfast=self.failfast).run(suite)
32+        return self.runnerclass(verbosity=self.verbosity, failfast=self.failfast).run(suite)
33 
34     def teardown_databases(self, old_config, **kwargs):
35         from django.db import connections