testing: Use failfast instead of fatal_errors.

`failfast` has the same meaning as `fatal_errors` in Django's test
runner.
This commit is contained in:
Umair Khan 2017-02-02 16:27:31 +05:00 committed by Tim Abbott
parent 7743f74180
commit e5a16ceb0a
2 changed files with 6 additions and 7 deletions

View File

@ -164,9 +164,8 @@ if __name__ == "__main__":
subprocess.call(generate_fixtures_command)
TestRunner = get_runner(settings)
test_runner = TestRunner()
failures = test_runner.run_tests(suites, fatal_errors=options.fatal_errors,
full_suite=full_suite)
test_runner = TestRunner(failfast=options.fatal_errors)
failures = test_runner.run_tests(suites, full_suite=full_suite)
templates_not_rendered = test_runner.get_shallow_tested_templates()
# We only check the templates if all the tests ran and passed

View File

@ -174,8 +174,8 @@ class Runner(DiscoverRunner):
# type: () -> Set[str]
return self.shallow_tested_templates
def run_suite(self, suite, fatal_errors=True):
# type: (Iterable[TestCase], bool) -> bool
def run_suite(self, suite, **kwargs):
# type: (Iterable[TestCase], **Any) -> bool
failed = False
for test in suite:
# The attributes __unittest_skip__ and __unittest_skip_why__ are undocumented
@ -183,7 +183,7 @@ class Runner(DiscoverRunner):
print('Skipping', full_test_name(test), "(%s)" % (test.__unittest_skip_why__,))
elif run_test(test):
failed = True
if fatal_errors:
if self.failfast:
return failed
return failed
@ -207,7 +207,7 @@ class Runner(DiscoverRunner):
# run a single test and getting an SA connection causes data from
# a Django connection to be rolled back mid-test.
get_sqlalchemy_connection()
failed = self.run_suite(suite, fatal_errors=kwargs.get('fatal_errors'))
failed = self.run_suite(suite)
self.teardown_test_environment()
if not failed:
write_instrumentation_reports(full_suite=full_suite)