From ef7e0ae53bf42942c3dcf1155962b90ab3f3e6fd Mon Sep 17 00:00:00 2001 From: Hasan Ramezani Date: Tue, 28 May 2019 11:37:37 +0200 Subject: [PATCH] Refs #28520 -- Added _module_match_label() hook to runtests.py. --- tests/runtests.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/runtests.py b/tests/runtests.py index e117df709b..cac4fa26e1 100755 --- a/tests/runtests.py +++ b/tests/runtests.py @@ -195,6 +195,10 @@ def setup(verbosity, test_labels, parallel): print('Aborting: A GIS database backend is required to run gis_tests.') sys.exit(1) + def _module_match_label(module_label, label): + # Exact or ancestor match. + return module_label == label or module_label.startswith(label + '.') + # Load all the test model apps. test_modules = get_test_modules() @@ -208,9 +212,7 @@ def setup(verbosity, test_labels, parallel): # 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( - # exact match or ancestor match - module_label == label or module_label.startswith(label + '.') - for label in test_labels_set + _module_match_label(module_label, label) for label in test_labels_set ) if module_name in CONTRIB_TESTS_TO_APPS and module_found_in_labels: