[1.11.x] Fixed AppRegistryNotReady error when running gis_tests in isolation on PostGIS.
Regression in890537253c
. Backport of4a251f8bce
from master
This commit is contained in:
parent
4e675999d5
commit
48274c1589
|
@ -113,10 +113,6 @@ def setup(verbosity, test_labels, parallel):
|
||||||
bits = label.split('.')[:1]
|
bits = label.split('.')[:1]
|
||||||
test_labels_set.add('.'.join(bits))
|
test_labels_set.add('.'.join(bits))
|
||||||
|
|
||||||
if 'gis_tests' in test_labels_set and not connection.features.gis_enabled:
|
|
||||||
print('Aborting: A GIS database backend is required to run gis_tests.')
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
if verbosity >= 1:
|
if verbosity >= 1:
|
||||||
msg = "Testing against Django installed in '%s'" % os.path.dirname(django.__file__)
|
msg = "Testing against Django installed in '%s'" % os.path.dirname(django.__file__)
|
||||||
max_parallel = default_test_processes() if parallel == 0 else parallel
|
max_parallel = default_test_processes() if parallel == 0 else parallel
|
||||||
|
@ -193,6 +189,14 @@ def setup(verbosity, test_labels, parallel):
|
||||||
# Load all the ALWAYS_INSTALLED_APPS.
|
# Load all the ALWAYS_INSTALLED_APPS.
|
||||||
django.setup()
|
django.setup()
|
||||||
|
|
||||||
|
# It would be nice to put this validation earlier but it must come after
|
||||||
|
# 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:
|
||||||
|
print('Aborting: A GIS database backend is required to run gis_tests.')
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
# Load all the test model apps.
|
# Load all the test model apps.
|
||||||
test_modules = get_test_modules()
|
test_modules = get_test_modules()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue