diff --git a/django/contrib/gis/tests/__init__.py b/django/contrib/gis/tests/__init__.py index 1703f3f1b3..e69de29bb2 100644 --- a/django/contrib/gis/tests/__init__.py +++ b/django/contrib/gis/tests/__init__.py @@ -1,30 +0,0 @@ -def geo_apps(): - """ - Returns a list of GeoDjango test applications that reside in - `django.contrib.gis.tests` that can be used with the current - database and the spatial libraries that are installed. - """ - from django.db import connection - from django.contrib.gis.geos import GEOS_PREPARE - from django.contrib.gis.gdal import HAS_GDAL - - apps = ['geoapp', 'relatedapp'] - - # No distance queries on MySQL. - if not connection.ops.mysql: - apps.append('distapp') - - # Test geography support with PostGIS 1.5+. - if connection.ops.postgis and connection.ops.geography: - apps.append('geogapp') - - # The following GeoDjango test apps depend on GDAL support. - if HAS_GDAL: - # Geographic admin, LayerMapping, and ogrinspect test apps - # all require GDAL. - apps.extend(['geoadmin', 'layermap', 'inspectapp']) - - # 3D apps use LayerMapping, which uses GDAL and require GEOS 3.1+. - if connection.ops.postgis and GEOS_PREPARE: - apps.append('geo3d') - return [('django.contrib.gis.tests', app) for app in apps] diff --git a/tests/runtests.py b/tests/runtests.py index b604155190..6cf89c709e 100755 --- a/tests/runtests.py +++ b/tests/runtests.py @@ -12,16 +12,19 @@ from django.utils._os import upath from django.utils import six CONTRIB_MODULE_PATH = 'django.contrib' +CONTRIB_GIS_TESTS_PATH = 'django.contrib.gis.tests' TEST_TEMPLATE_DIR = 'templates' RUNTESTS_DIR = os.path.abspath(os.path.dirname(upath(__file__))) CONTRIB_DIR = os.path.dirname(upath(contrib.__file__)) +CONTRIB_GIS_TESTS_DIR = os.path.join(CONTRIB_DIR, 'gis', 'tests') TEMP_DIR = tempfile.mkdtemp(prefix='django_') os.environ['DJANGO_TEST_TEMP_DIR'] = TEMP_DIR SUBDIRS_TO_SKIP = [ + 'data', 'templates', 'test_discovery_sample', 'test_discovery_sample2', @@ -52,7 +55,8 @@ def get_test_modules(): modules = [] for modpath, dirpath in ( (None, RUNTESTS_DIR), - (CONTRIB_MODULE_PATH, CONTRIB_DIR)): + (CONTRIB_MODULE_PATH, CONTRIB_DIR), + (CONTRIB_GIS_TESTS_PATH, CONTRIB_GIS_TESTS_DIR)): for f in os.listdir(dirpath): if ('.' in f or # Python 3 byte code dirs (PEP 3147) @@ -64,6 +68,7 @@ def get_test_modules(): modules.append((modpath, f)) return modules + def get_installed(): from django.db.models.loading import get_apps return [app.__name__.rsplit('.', 1)[0] for app in get_apps()] @@ -125,14 +130,6 @@ def setup(verbosity, test_labels): bits = bits[:1] test_labels_set.add('.'.join(bits)) - # If GeoDjango, then we'll want to add in the test applications - # that are a part of its test suite. - from django.contrib.gis.tests.utils import HAS_SPATIAL_DB - if HAS_SPATIAL_DB: - from django.contrib.gis.tests import geo_apps - test_modules.extend(geo_apps()) - settings.INSTALLED_APPS.extend(['django.contrib.gis', 'django.contrib.sitemaps']) - for modpath, module_name in test_modules: if modpath: module_label = '.'.join([modpath, module_name])