diff options
| author | Claude Paroz <claude@2xlibre.net> | 2013-07-09 15:58:56 +0200 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2013-07-09 15:58:56 +0200 |
| commit | 57f190ed3b77eb105cc86ecfabc455662410d40a (patch) | |
| tree | 8bf86574fbb36a439ee47ec6f94b801bc7f9deff /tests | |
| parent | bd563f0f571e7c76b40e8c8d7a0e1f34dcfeb810 (diff) | |
Only import gis test apps for geo-enabled DBs
Diffstat (limited to 'tests')
| -rwxr-xr-x | tests/runtests.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/tests/runtests.py b/tests/runtests.py index 6cf89c709e..349373aa73 100755 --- a/tests/runtests.py +++ b/tests/runtests.py @@ -12,13 +12,11 @@ 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 @@ -52,11 +50,18 @@ ALWAYS_INSTALLED_APPS = [ def get_test_modules(): + from django.contrib.gis.tests.utils import HAS_SPATIAL_DB modules = [] - for modpath, dirpath in ( + discovery_paths = [ (None, RUNTESTS_DIR), - (CONTRIB_MODULE_PATH, CONTRIB_DIR), - (CONTRIB_GIS_TESTS_PATH, CONTRIB_GIS_TESTS_DIR)): + (CONTRIB_MODULE_PATH, CONTRIB_DIR) + ] + if HAS_SPATIAL_DB: + discovery_paths.append( + ('django.contrib.gis.tests', os.path.join(CONTRIB_DIR, 'gis', 'tests')) + ) + + for modpath, dirpath in discovery_paths: for f in os.listdir(dirpath): if ('.' in f or # Python 3 byte code dirs (PEP 3147) |
