Refs #32668 -- Made setup()'s test_labels argument optional in runtests.py.

This commit is contained in:
Chris Jerdonek 2021-04-21 04:02:58 -07:00 committed by Mariusz Felisiak
parent 62e8f369c3
commit 90f41c2d91
1 changed files with 5 additions and 4 deletions

View File

@ -132,7 +132,9 @@ def get_installed():
return [app_config.name for app_config in apps.get_app_configs()] return [app_config.name for app_config in apps.get_app_configs()]
def setup(verbosity, test_labels, start_at, start_after): def setup(verbosity, start_at, start_after, test_labels=None):
if test_labels is None:
test_labels = []
# Reduce each test label to just the top-level module part. # Reduce each test label to just the top-level module part.
test_labels_set = set() test_labels_set = set()
for label in test_labels: for label in test_labels:
@ -309,7 +311,7 @@ def django_tests(verbosity, interactive, failfast, keepdb, reverse,
msg += " with up to %d processes" % max_parallel msg += " with up to %d processes" % max_parallel
print(msg) print(msg)
state = setup(verbosity, test_labels, start_at, start_after) state = setup(verbosity, start_at, start_after, test_labels)
# Run the test suite, including the extra validation tests. # Run the test suite, including the extra validation tests.
if not hasattr(settings, 'TEST_RUNNER'): if not hasattr(settings, 'TEST_RUNNER'):
settings.TEST_RUNNER = 'django.test.runner.DiscoverRunner' settings.TEST_RUNNER = 'django.test.runner.DiscoverRunner'
@ -335,8 +337,7 @@ def django_tests(verbosity, interactive, failfast, keepdb, reverse,
def get_app_test_labels(verbosity, start_at, start_after): def get_app_test_labels(verbosity, start_at, start_after):
test_labels = [] state = setup(verbosity, start_at, start_after)
state = setup(verbosity, test_labels, start_at, start_after)
test_labels = get_installed() test_labels = get_installed()
teardown(state) teardown(state)
return test_labels return test_labels