From e7e39d32fd3aa53cf2861f083c24f9d1b38572d6 Mon Sep 17 00:00:00 2001 From: Claude Paroz Date: Tue, 5 May 2015 20:11:02 +0200 Subject: [PATCH] Made some tests run on non-GIS databases --- tests/gis_tests/inspectapp/tests.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/gis_tests/inspectapp/tests.py b/tests/gis_tests/inspectapp/tests.py index c40ffaa7e8..f13390aa19 100644 --- a/tests/gis_tests/inspectapp/tests.py +++ b/tests/gis_tests/inspectapp/tests.py @@ -8,6 +8,7 @@ from django.contrib.gis.gdal import HAS_GDAL from django.core.management import call_command from django.db import connection, connections from django.test import TestCase, skipUnlessDBFeature +from django.test.utils import modify_settings from django.utils.six import StringIO from ..test_data import TEST_DATA @@ -20,8 +21,8 @@ if HAS_GDAL: @skipUnless(HAS_GDAL, "InspectDbTests needs GDAL support") -@skipUnlessDBFeature("gis_enabled") class InspectDbTests(TestCase): + @skipUnlessDBFeature("gis_enabled") def test_geom_columns(self): """ Test the geo-enabled inspectdb command. @@ -62,7 +63,9 @@ class InspectDbTests(TestCase): @skipUnless(HAS_GDAL, "OGRInspectTest needs GDAL support") -@skipUnlessDBFeature("gis_enabled") +@modify_settings( + INSTALLED_APPS={'append': 'django.contrib.gis'}, +) class OGRInspectTest(TestCase): maxDiff = 1024 @@ -84,6 +87,11 @@ class OGRInspectTest(TestCase): self.assertEqual(model_def, '\n'.join(expected)) + def test_poly_multi(self): + shp_file = os.path.join(TEST_DATA, 'test_poly', 'test_poly.shp') + model_def = ogrinspect(shp_file, 'MyModel', multi_geom=True) + self.assertIn('geom = models.MultiPolygonField(srid=-1)', model_def) + def test_date_field(self): shp_file = os.path.join(TEST_DATA, 'cities', 'cities.shp') model_def = ogrinspect(shp_file, 'City')