mirror of https://github.com/zulip/zulip.git
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:
parent
7743f74180
commit
e5a16ceb0a
|
@ -164,9 +164,8 @@ if __name__ == "__main__":
|
||||||
subprocess.call(generate_fixtures_command)
|
subprocess.call(generate_fixtures_command)
|
||||||
|
|
||||||
TestRunner = get_runner(settings)
|
TestRunner = get_runner(settings)
|
||||||
test_runner = TestRunner()
|
test_runner = TestRunner(failfast=options.fatal_errors)
|
||||||
failures = test_runner.run_tests(suites, fatal_errors=options.fatal_errors,
|
failures = test_runner.run_tests(suites, full_suite=full_suite)
|
||||||
full_suite=full_suite)
|
|
||||||
|
|
||||||
templates_not_rendered = test_runner.get_shallow_tested_templates()
|
templates_not_rendered = test_runner.get_shallow_tested_templates()
|
||||||
# We only check the templates if all the tests ran and passed
|
# We only check the templates if all the tests ran and passed
|
||||||
|
|
|
@ -174,8 +174,8 @@ class Runner(DiscoverRunner):
|
||||||
# type: () -> Set[str]
|
# type: () -> Set[str]
|
||||||
return self.shallow_tested_templates
|
return self.shallow_tested_templates
|
||||||
|
|
||||||
def run_suite(self, suite, fatal_errors=True):
|
def run_suite(self, suite, **kwargs):
|
||||||
# type: (Iterable[TestCase], bool) -> bool
|
# type: (Iterable[TestCase], **Any) -> bool
|
||||||
failed = False
|
failed = False
|
||||||
for test in suite:
|
for test in suite:
|
||||||
# The attributes __unittest_skip__ and __unittest_skip_why__ are undocumented
|
# 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__,))
|
print('Skipping', full_test_name(test), "(%s)" % (test.__unittest_skip_why__,))
|
||||||
elif run_test(test):
|
elif run_test(test):
|
||||||
failed = True
|
failed = True
|
||||||
if fatal_errors:
|
if self.failfast:
|
||||||
return failed
|
return failed
|
||||||
return failed
|
return failed
|
||||||
|
|
||||||
|
@ -207,7 +207,7 @@ class Runner(DiscoverRunner):
|
||||||
# run a single test and getting an SA connection causes data from
|
# run a single test and getting an SA connection causes data from
|
||||||
# a Django connection to be rolled back mid-test.
|
# a Django connection to be rolled back mid-test.
|
||||||
get_sqlalchemy_connection()
|
get_sqlalchemy_connection()
|
||||||
failed = self.run_suite(suite, fatal_errors=kwargs.get('fatal_errors'))
|
failed = self.run_suite(suite)
|
||||||
self.teardown_test_environment()
|
self.teardown_test_environment()
|
||||||
if not failed:
|
if not failed:
|
||||||
write_instrumentation_reports(full_suite=full_suite)
|
write_instrumentation_reports(full_suite=full_suite)
|
||||||
|
|
Loading…
Reference in New Issue