Skip GeometryFieldTest if there's no spacial database.
This commit is contained in:
parent
5bdd0d6b6a
commit
1794e36fa1
|
@ -44,6 +44,18 @@ 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:
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
from django.forms import ValidationError
|
||||
from django.contrib.gis import forms
|
||||
from django.contrib.gis.gdal import HAS_GDAL
|
||||
from django.contrib.gis.geos import GEOSGeometry
|
||||
from django.contrib.gis.gdal import HAS_GDAL, HAS_SPATIALREFSYS
|
||||
from django.utils import unittest
|
||||
|
||||
|
||||
@unittest.skipUnless(HAS_GDAL, "GeometryFieldTest needs gdal support")
|
||||
if HAS_SPATIALREFSYS:
|
||||
from django.contrib.gis import forms
|
||||
from django.contrib.gis.geos import GEOSGeometry
|
||||
|
||||
@unittest.skipUnless(HAS_GDAL and HAS_SPATIALREFSYS, "GeometryFieldTest needs gdal support and a spatial database")
|
||||
class GeometryFieldTest(unittest.TestCase):
|
||||
|
||||
def test00_init(self):
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
from django.db import connection
|
||||
from django.contrib.gis.gdal import HAS_GDAL
|
||||
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.utils import unittest
|
||||
|
||||
|
@ -28,16 +28,6 @@ test_srs = ({'srid' : 4326,
|
|||
},
|
||||
)
|
||||
|
||||
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
|
||||
|
||||
@unittest.skipUnless(HAS_GDAL and HAS_SPATIALREFSYS,
|
||||
"SpatialRefSysTest needs gdal support and a spatial database")
|
||||
class SpatialRefSysTest(unittest.TestCase):
|
||||
|
|
Loading…
Reference in New Issue