1
0
mirror of https://github.com/django/django.git synced 2025-10-23 21:59:11 +00:00

Fixed #26753 -- Made GDAL a required dependency for contrib.gis

Thanks Tim Graham for the review.
This commit is contained in:
Claude Paroz
2016-06-14 16:18:33 +02:00
parent 7def55c3f6
commit f7a363ee1d
29 changed files with 117 additions and 368 deletions

View File

@@ -7,18 +7,14 @@ from django.contrib.gis.gdal import HAS_GDAL
from django.contrib.gis.geos import GEOSGeometry
from django.contrib.gis.measure import D
from django.contrib.gis.shortcuts import numpy
from django.core.exceptions import ImproperlyConfigured
from django.db.models import Q
from django.test import (
TestCase, TransactionTestCase, mock, skipUnlessDBFeature,
)
from django.test import TransactionTestCase, skipUnlessDBFeature
from ..data.rasters.textrasters import JSON_RASTER
from ..models import models
from .models import RasterModel, RasterRelatedModel
if HAS_GDAL:
from django.contrib.gis.gdal import GDALRaster
from .models import RasterModel, RasterRelatedModel
@skipUnlessDBFeature('supports_raster')
@@ -330,12 +326,3 @@ class RasterFieldTest(TransactionTestCase):
msg = "Couldn't create spatial object from lookup value '%s'." % obj
with self.assertRaisesMessage(ValueError, msg):
RasterModel.objects.filter(geom__intersects=obj)
@mock.patch('django.contrib.gis.db.models.fields.HAS_GDAL', False)
class RasterFieldWithoutGDALTest(TestCase):
def test_raster_field_without_gdal_exception(self):
msg = 'RasterField requires GDAL.'
with self.assertRaisesMessage(ImproperlyConfigured, msg):
models.OriginalRasterField()