Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Django 1.8 #25

Merged
merged 1 commit into from
Oct 30, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
29 changes: 18 additions & 11 deletions setuptest/setuptest.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class LabelException(Exception):
class SetupTestSuite(unittest.TestSuite):
"""
Test Suite configuring Django settings and using
DjangoTestSuiteRunner as test runner.
DiscoverRunner or DjangoTestSuiteRunner as the test runner.
Also runs PEP8 and Coverage checks.
"""
def __init__(self, *args, **kwargs):
Expand All @@ -36,16 +36,23 @@ def __init__(self, *args, **kwargs):
self.options = vars(parser.parse_args(sys.argv[2:]))
sys.argv = sys.argv[:2]

super(SetupTestSuite, self).__init__(tests=self.build_tests(),
*args, **kwargs)
runner_options = {
'verbosity': 1,
'interactive': True,
'failfast': False,
}

if django.VERSION >= (1, 8):
from django.test.runner import DiscoverRunner
self.test_runner = DiscoverRunner(**runner_options)
tests = self.test_runner.build_suite()
else:
from django.test.simple import DjangoTestSuiteRunner
self.test_runner = DjangoTestSuiteRunner(**runner_options)
tests = self.build_tests()

super(SetupTestSuite, self).__init__(tests=tests, *args, **kwargs)

# Setup testrunner.
from django.test.simple import DjangoTestSuiteRunner
self.test_runner = DjangoTestSuiteRunner(
verbosity=1,
interactive=True,
failfast=False
)
# South patches the test management command to handle the
# SOUTH_TESTS_MIGRATE setting. Apply that patch if South is installed.
if django.VERSION < (1,7):
Expand Down Expand Up @@ -80,7 +87,7 @@ def handle_label_exception(self, exception):

def build_tests(self):
"""
Build tests for inclusion in suite from resolved packages.
Build tests for inclusion in suite from resolved packages for <= 1.8
TODO: Cleanup/simplify this method, flow too complex,
too much duplication.
"""
Expand Down