Refs #32668 -- Refactored away module_found_in_labels in runtests.py's setup().

This commit is contained in:
Chris Jerdonek 2021-04-09 06:21:29 -07:00 committed by Mariusz Felisiak
parent 90f41c2d91
commit ffc0d57a04
1 changed files with 6 additions and 5 deletions

View File

@ -231,16 +231,17 @@ def setup(verbosity, start_at, start_after, test_labels=None):
# if the module (or an ancestor) was named on the command line, or
# no modules were named (i.e., run all), import
# this module and add it to INSTALLED_APPS.
module_found_in_labels = not test_labels or any(
_module_match_label(module_label, label) for label in test_labels_set
)
if test_labels and not any(
_module_match_label(test_module, label) for label in test_labels_set
):
continue
if module_name in CONTRIB_TESTS_TO_APPS and module_found_in_labels:
if module_name in CONTRIB_TESTS_TO_APPS:
for contrib_app in CONTRIB_TESTS_TO_APPS[module_name]:
if contrib_app not in settings.INSTALLED_APPS:
settings.INSTALLED_APPS.append(contrib_app)
if module_found_in_labels and module_label not in installed_app_names:
if module_label not in installed_app_names:
if verbosity >= 2:
print("Importing application %s" % module_name)
settings.INSTALLED_APPS.append(module_label)