diff --git a/django/contrib/gis/geos/__init__.py b/django/contrib/gis/geos/__init__.py index 561657a655..22a01a4cf2 100644 --- a/django/contrib/gis/geos/__init__.py +++ b/django/contrib/gis/geos/__init__.py @@ -13,8 +13,3 @@ from .libgeos import geos_version, geos_version_info # NOQA from .linestring import LinearRing, LineString # NOQA from .point import Point # NOQA from .polygon import Polygon # NOQA - -try: - HAS_GEOS = geos_version_info()['version'] >= '3.3.0' -except ImportError: - HAS_GEOS = False diff --git a/tests/gis_tests/geos_tests/test_geos.py b/tests/gis_tests/geos_tests/test_geos.py index a3da015314..602c37503d 100644 --- a/tests/gis_tests/geos_tests/test_geos.py +++ b/tests/gis_tests/geos_tests/test_geos.py @@ -4,13 +4,13 @@ import pickle import random from binascii import a2b_hex, b2a_hex from io import BytesIO -from unittest import mock, skipUnless +from unittest import mock from django.contrib.gis import gdal from django.contrib.gis.geos import ( - HAS_GEOS, GeometryCollection, GEOSException, GEOSGeometry, LinearRing, - LineString, MultiLineString, MultiPoint, MultiPolygon, Point, Polygon, - fromfile, fromstr, + GeometryCollection, GEOSException, GEOSGeometry, LinearRing, LineString, + MultiLineString, MultiPoint, MultiPolygon, Point, Polygon, fromfile, + fromstr, ) from django.contrib.gis.geos.libgeos import geos_version_info from django.contrib.gis.shortcuts import numpy @@ -22,7 +22,6 @@ from django.utils.encoding import force_bytes from ..test_data import TestDataMixin -@skipUnless(HAS_GEOS, "Geos is required.") class GEOSTest(SimpleTestCase, TestDataMixin): def test_wkt(self): diff --git a/tests/gis_tests/geos_tests/test_geos_mutation.py b/tests/gis_tests/geos_tests/test_geos_mutation.py index d2fd29bdb2..2eedef31d9 100644 --- a/tests/gis_tests/geos_tests/test_geos_mutation.py +++ b/tests/gis_tests/geos_tests/test_geos_mutation.py @@ -3,10 +3,9 @@ # released under the New BSD license. import unittest -from unittest import skipUnless from django.contrib.gis.geos import ( - HAS_GEOS, LinearRing, LineString, MultiPoint, Point, Polygon, fromstr, + LinearRing, LineString, MultiPoint, Point, Polygon, fromstr, ) @@ -72,7 +71,6 @@ geos_function_tests = [ ] -@skipUnless(HAS_GEOS, "Geos is required.") class GEOSMutationTest(unittest.TestCase): """ Tests Pythonic Mutability of Python GEOS geometry wrappers diff --git a/tests/gis_tests/geos_tests/test_io.py b/tests/gis_tests/geos_tests/test_io.py index 98b2aba3b4..1ab7d6483e 100644 --- a/tests/gis_tests/geos_tests/test_io.py +++ b/tests/gis_tests/geos_tests/test_io.py @@ -1,14 +1,11 @@ import binascii -from unittest import skipUnless from django.contrib.gis.geos import ( - HAS_GEOS, GEOSGeometry, Point, Polygon, WKBReader, WKBWriter, WKTReader, - WKTWriter, + GEOSGeometry, Point, Polygon, WKBReader, WKBWriter, WKTReader, WKTWriter, ) from django.test import SimpleTestCase -@skipUnless(HAS_GEOS, "Geos is required.") class GEOSIOTest(SimpleTestCase): def test01_wktreader(self): diff --git a/tests/gis_tests/layermap/tests.py b/tests/gis_tests/layermap/tests.py index f03ff81592..1ebeeb31c6 100644 --- a/tests/gis_tests/layermap/tests.py +++ b/tests/gis_tests/layermap/tests.py @@ -4,22 +4,18 @@ from copy import copy from decimal import Decimal from django.conf import settings -from django.contrib.gis.geos import HAS_GEOS +from django.contrib.gis.gdal import DataSource +from django.contrib.gis.utils.layermapping import ( + InvalidDecimal, InvalidString, LayerMapError, LayerMapping, + MissingForeignKey, +) from django.db import connection from django.test import TestCase, override_settings -if HAS_GEOS: - from django.contrib.gis.utils.layermapping import ( - LayerMapping, LayerMapError, InvalidDecimal, InvalidString, - MissingForeignKey, - ) - from django.contrib.gis.gdal import DataSource - - from .models import ( - City, County, CountyFeat, Interstate, ICity1, ICity2, Invalid, State, - city_mapping, co_mapping, cofeat_mapping, inter_mapping, - ) - +from .models import ( + City, County, CountyFeat, ICity1, ICity2, Interstate, Invalid, State, + city_mapping, co_mapping, cofeat_mapping, inter_mapping, +) shp_path = os.path.realpath(os.path.join(os.path.dirname(__file__), os.pardir, 'data')) city_shp = os.path.join(shp_path, 'cities', 'cities.shp') diff --git a/tests/gis_tests/test_geoip2.py b/tests/gis_tests/test_geoip2.py index 7d6b965d12..3d3677f36b 100644 --- a/tests/gis_tests/test_geoip2.py +++ b/tests/gis_tests/test_geoip2.py @@ -4,7 +4,7 @@ from unittest import mock, skipUnless from django.conf import settings from django.contrib.gis.geoip2 import HAS_GEOIP2 -from django.contrib.gis.geos import HAS_GEOS, GEOSGeometry +from django.contrib.gis.geos import GEOSGeometry if HAS_GEOIP2: from django.contrib.gis.geoip2 import GeoIP2, GeoIP2Exception @@ -90,7 +90,6 @@ class GeoIPTest(unittest.TestCase): g.country(query) ) - @skipUnless(HAS_GEOS, "Geos is required") @mock.patch('socket.gethostbyname') def test04_city(self, gethostbyname): "GeoIP city querying methods."