Allowed running GIS form tests that don't require spatial database
This commit is contained in:
parent
2ddf1fc50f
commit
07fe0bf3f4
|
@ -1,16 +1,14 @@
|
||||||
from unittest import skipUnless
|
from unittest import skipUnless
|
||||||
|
|
||||||
from django.forms import ValidationError
|
from django.forms import ValidationError
|
||||||
|
from django.contrib.gis import forms
|
||||||
from django.contrib.gis.gdal import HAS_GDAL
|
from django.contrib.gis.gdal import HAS_GDAL
|
||||||
|
from django.contrib.gis.geos import GEOSGeometry
|
||||||
from django.contrib.gis.tests.utils import HAS_SPATIALREFSYS
|
from django.contrib.gis.tests.utils import HAS_SPATIALREFSYS
|
||||||
from django.test import SimpleTestCase
|
from django.test import SimpleTestCase
|
||||||
from django.utils import six
|
from django.utils import six
|
||||||
from django.utils.html import escape
|
from django.utils.html import escape
|
||||||
|
|
||||||
if HAS_SPATIALREFSYS:
|
|
||||||
from django.contrib.gis import forms
|
|
||||||
from django.contrib.gis.geos import GEOSGeometry
|
|
||||||
|
|
||||||
|
|
||||||
@skipUnless(HAS_GDAL and HAS_SPATIALREFSYS, "GeometryFieldTest needs gdal support and a spatial database")
|
@skipUnless(HAS_GDAL and HAS_SPATIALREFSYS, "GeometryFieldTest needs gdal support and a spatial database")
|
||||||
class GeometryFieldTest(SimpleTestCase):
|
class GeometryFieldTest(SimpleTestCase):
|
||||||
|
@ -258,14 +256,14 @@ class SpecializedFieldTest(SimpleTestCase):
|
||||||
self.assertFalse(GeometryForm(data={'g': invalid.wkt}).is_valid())
|
self.assertFalse(GeometryForm(data={'g': invalid.wkt}).is_valid())
|
||||||
|
|
||||||
|
|
||||||
@skipUnless(HAS_GDAL and HAS_SPATIALREFSYS,
|
|
||||||
"OSMWidgetTest needs gdal support and a spatial database")
|
|
||||||
class OSMWidgetTest(SimpleTestCase):
|
class OSMWidgetTest(SimpleTestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.geometries = {
|
self.geometries = {
|
||||||
'point': GEOSGeometry("SRID=4326;POINT(9.052734375 42.451171875)"),
|
'point': GEOSGeometry("SRID=4326;POINT(9.052734375 42.451171875)"),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@skipUnless(HAS_GDAL and HAS_SPATIALREFSYS,
|
||||||
|
"test_osm_widget needs gdal support and a spatial database")
|
||||||
def test_osm_widget(self):
|
def test_osm_widget(self):
|
||||||
class PointForm(forms.Form):
|
class PointForm(forms.Form):
|
||||||
p = forms.PointField(widget=forms.OSMWidget)
|
p = forms.PointField(widget=forms.OSMWidget)
|
||||||
|
|
Loading…
Reference in New Issue