-
-
Save thachhoang/8885808 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from django.conf import settings | |
| from django.test.simple import DjangoTestSuiteRunner, reorder_suite | |
| from django.utils.unittest import TestCase | |
| from django.utils.unittest.loader import defaultTestLoader | |
| class DiscoveryDjangoTestSuiteRunner(DjangoTestSuiteRunner): | |
| def build_suite(self, test_labels, extra_tests=None, **kwargs): | |
| if test_labels: | |
| suite = defaultTestLoader.loadTestsFromNames(test_labels) | |
| else: | |
| suite = defaultTestLoader.discover(settings.TEST_DISCOVERY_ROOT) | |
| if extra_tests: | |
| for test in extra_tests: | |
| suite.addTest(test) | |
| return reorder_suite(suite, (TestCase,)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment