From ac1b9ae6301e2c38af7951f1feb56dafc380d3e7 Mon Sep 17 00:00:00 2001 From: Florian Apolloner Date: Sun, 17 Jun 2012 11:39:02 +0200 Subject: [PATCH] Fixed GIS testsuite. Moved HAS_SPATIALREFSYS back into the tests namespace since it only operates on the default database and isn't a global flag like HAS_GDAL. --- django/contrib/gis/gdal/__init__.py | 12 ------------ django/contrib/gis/tests/test_geoforms.py | 3 ++- django/contrib/gis/tests/test_spatialrefsys.py | 5 +++-- django/contrib/gis/tests/utils.py | 11 +++++++++++ 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/django/contrib/gis/gdal/__init__.py b/django/contrib/gis/gdal/__init__.py index c62197f3854..5c336f32103 100644 --- a/django/contrib/gis/gdal/__init__.py +++ b/django/contrib/gis/gdal/__init__.py @@ -44,18 +44,6 @@ try: except: HAS_GDAL, GEOJSON = False, False -from django.contrib.gis.tests.utils import no_mysql, oracle, postgis, spatialite -HAS_SPATIALREFSYS = True -if oracle: - from django.contrib.gis.db.backends.oracle.models import SpatialRefSys -elif postgis: - from django.contrib.gis.db.backends.postgis.models import SpatialRefSys -elif spatialite: - from django.contrib.gis.db.backends.spatialite.models import SpatialRefSys -else: - HAS_SPATIALREFSYS = False - SpatialRefSys = None - try: from django.contrib.gis.gdal.envelope import Envelope except ImportError: diff --git a/django/contrib/gis/tests/test_geoforms.py b/django/contrib/gis/tests/test_geoforms.py index 913e2db975d..9d2b7c7c3cd 100644 --- a/django/contrib/gis/tests/test_geoforms.py +++ b/django/contrib/gis/tests/test_geoforms.py @@ -1,5 +1,6 @@ from django.forms import ValidationError -from django.contrib.gis.gdal import HAS_GDAL, HAS_SPATIALREFSYS +from django.contrib.gis.gdal import HAS_GDAL +from django.contrib.gis.tests.utils import HAS_SPATIALREFSYS from django.utils import unittest diff --git a/django/contrib/gis/tests/test_spatialrefsys.py b/django/contrib/gis/tests/test_spatialrefsys.py index 47e406066af..5cdc68a74d5 100644 --- a/django/contrib/gis/tests/test_spatialrefsys.py +++ b/django/contrib/gis/tests/test_spatialrefsys.py @@ -1,6 +1,7 @@ from django.db import connection -from django.contrib.gis.gdal import HAS_GDAL, HAS_SPATIALREFSYS, SpatialRefSys -from django.contrib.gis.tests.utils import no_mysql, oracle, postgis, spatialite +from django.contrib.gis.gdal import HAS_GDAL +from django.contrib.gis.tests.utils import (no_mysql, oracle, postgis, + spatialite, HAS_SPATIALREFSYS, SpatialRefSys) from django.utils import unittest diff --git a/django/contrib/gis/tests/utils.py b/django/contrib/gis/tests/utils.py index b758fd0fee3..a83ba8a93fc 100644 --- a/django/contrib/gis/tests/utils.py +++ b/django/contrib/gis/tests/utils.py @@ -24,3 +24,14 @@ oracle = _default_db == 'oracle' postgis = _default_db == 'postgis' mysql = _default_db == 'mysql' spatialite = _default_db == 'spatialite' + +HAS_SPATIALREFSYS = True +if oracle: + from django.contrib.gis.db.backends.oracle.models import SpatialRefSys +elif postgis: + from django.contrib.gis.db.backends.postgis.models import SpatialRefSys +elif spatialite: + from django.contrib.gis.db.backends.spatialite.models import SpatialRefSys +else: + HAS_SPATIALREFSYS = False + SpatialRefSys = None