summaryrefslogtreecommitdiff
path: root/tests/runtests.py
diff options
context:
space:
mode:
authorChris Jerdonek <chris.jerdonek@gmail.com>2021-06-03 22:09:33 -0700
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2021-06-07 08:54:15 +0200
commit9b9cea04b98b66a68b7588cc4c34401f5f7d7c12 (patch)
tree9b1b7abdf94eab6a0273c57cec6c745b015ceef9 /tests/runtests.py
parent651e527f9b3bc93f04ead654ca215d4252e25fb6 (diff)
downloaddjango-9b9cea04b98b66a68b7588cc4c34401f5f7d7c12.tar.gz
Refs #32668 -- Added gis_enabled argument to get_test_modules().
Diffstat (limited to 'tests/runtests.py')
-rwxr-xr-xtests/runtests.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/tests/runtests.py b/tests/runtests.py
index eef7afa7c1..16942e249b 100755
--- a/tests/runtests.py
+++ b/tests/runtests.py
@@ -110,7 +110,7 @@ CONTRIB_TESTS_TO_APPS = {
}
-def get_test_modules():
+def get_test_modules(gis_enabled):
"""
Scan the tests directory and yield the names of all test modules.
@@ -118,7 +118,7 @@ def get_test_modules():
the case of GIS tests, two dotted parts like "gis_tests.gdal_tests".
"""
discovery_dirs = ['']
- if connection.features.gis_enabled:
+ if gis_enabled:
# GIS tests are in nested apps
discovery_dirs.append('gis_tests')
else:
@@ -216,7 +216,8 @@ def setup(verbosity, start_at, start_after, test_labels=None):
# django.setup() so that connection.features.gis_enabled can be accessed
# without raising AppRegistryNotReady when running gis_tests in isolation
# on some backends (e.g. PostGIS).
- if 'gis_tests' in test_labels_set and not connection.features.gis_enabled:
+ gis_enabled = connection.features.gis_enabled
+ if 'gis_tests' in test_labels_set and not gis_enabled:
print('Aborting: A GIS database backend is required to run gis_tests.')
sys.exit(1)
@@ -226,7 +227,7 @@ def setup(verbosity, start_at, start_after, test_labels=None):
start_label = start_at or start_after
installed_app_names = set(get_installed())
- for test_module in get_test_modules():
+ for test_module in get_test_modules(gis_enabled):
if start_label:
if not _module_match_label(test_module, start_label):
continue