Removed obsolete HAS_GEOS variable for test skipping.
This commit is contained in:
parent
2dc3280254
commit
b014de011b
|
@ -13,8 +13,3 @@ from .libgeos import geos_version, geos_version_info # NOQA
|
||||||
from .linestring import LinearRing, LineString # NOQA
|
from .linestring import LinearRing, LineString # NOQA
|
||||||
from .point import Point # NOQA
|
from .point import Point # NOQA
|
||||||
from .polygon import Polygon # NOQA
|
from .polygon import Polygon # NOQA
|
||||||
|
|
||||||
try:
|
|
||||||
HAS_GEOS = geos_version_info()['version'] >= '3.3.0'
|
|
||||||
except ImportError:
|
|
||||||
HAS_GEOS = False
|
|
||||||
|
|
|
@ -4,13 +4,13 @@ import pickle
|
||||||
import random
|
import random
|
||||||
from binascii import a2b_hex, b2a_hex
|
from binascii import a2b_hex, b2a_hex
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
from unittest import mock, skipUnless
|
from unittest import mock
|
||||||
|
|
||||||
from django.contrib.gis import gdal
|
from django.contrib.gis import gdal
|
||||||
from django.contrib.gis.geos import (
|
from django.contrib.gis.geos import (
|
||||||
HAS_GEOS, GeometryCollection, GEOSException, GEOSGeometry, LinearRing,
|
GeometryCollection, GEOSException, GEOSGeometry, LinearRing, LineString,
|
||||||
LineString, MultiLineString, MultiPoint, MultiPolygon, Point, Polygon,
|
MultiLineString, MultiPoint, MultiPolygon, Point, Polygon, fromfile,
|
||||||
fromfile, fromstr,
|
fromstr,
|
||||||
)
|
)
|
||||||
from django.contrib.gis.geos.libgeos import geos_version_info
|
from django.contrib.gis.geos.libgeos import geos_version_info
|
||||||
from django.contrib.gis.shortcuts import numpy
|
from django.contrib.gis.shortcuts import numpy
|
||||||
|
@ -22,7 +22,6 @@ from django.utils.encoding import force_bytes
|
||||||
from ..test_data import TestDataMixin
|
from ..test_data import TestDataMixin
|
||||||
|
|
||||||
|
|
||||||
@skipUnless(HAS_GEOS, "Geos is required.")
|
|
||||||
class GEOSTest(SimpleTestCase, TestDataMixin):
|
class GEOSTest(SimpleTestCase, TestDataMixin):
|
||||||
|
|
||||||
def test_wkt(self):
|
def test_wkt(self):
|
||||||
|
|
|
@ -3,10 +3,9 @@
|
||||||
# released under the New BSD license.
|
# released under the New BSD license.
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
from unittest import skipUnless
|
|
||||||
|
|
||||||
from django.contrib.gis.geos import (
|
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):
|
class GEOSMutationTest(unittest.TestCase):
|
||||||
"""
|
"""
|
||||||
Tests Pythonic Mutability of Python GEOS geometry wrappers
|
Tests Pythonic Mutability of Python GEOS geometry wrappers
|
||||||
|
|
|
@ -1,14 +1,11 @@
|
||||||
import binascii
|
import binascii
|
||||||
from unittest import skipUnless
|
|
||||||
|
|
||||||
from django.contrib.gis.geos import (
|
from django.contrib.gis.geos import (
|
||||||
HAS_GEOS, GEOSGeometry, Point, Polygon, WKBReader, WKBWriter, WKTReader,
|
GEOSGeometry, Point, Polygon, WKBReader, WKBWriter, WKTReader, WKTWriter,
|
||||||
WKTWriter,
|
|
||||||
)
|
)
|
||||||
from django.test import SimpleTestCase
|
from django.test import SimpleTestCase
|
||||||
|
|
||||||
|
|
||||||
@skipUnless(HAS_GEOS, "Geos is required.")
|
|
||||||
class GEOSIOTest(SimpleTestCase):
|
class GEOSIOTest(SimpleTestCase):
|
||||||
|
|
||||||
def test01_wktreader(self):
|
def test01_wktreader(self):
|
||||||
|
|
|
@ -4,22 +4,18 @@ from copy import copy
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
|
|
||||||
from django.conf import settings
|
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.db import connection
|
||||||
from django.test import TestCase, override_settings
|
from django.test import TestCase, override_settings
|
||||||
|
|
||||||
if HAS_GEOS:
|
from .models import (
|
||||||
from django.contrib.gis.utils.layermapping import (
|
City, County, CountyFeat, ICity1, ICity2, Interstate, Invalid, State,
|
||||||
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,
|
city_mapping, co_mapping, cofeat_mapping, inter_mapping,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
shp_path = os.path.realpath(os.path.join(os.path.dirname(__file__), os.pardir, 'data'))
|
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')
|
city_shp = os.path.join(shp_path, 'cities', 'cities.shp')
|
||||||
|
|
|
@ -4,7 +4,7 @@ from unittest import mock, skipUnless
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.contrib.gis.geoip2 import HAS_GEOIP2
|
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:
|
if HAS_GEOIP2:
|
||||||
from django.contrib.gis.geoip2 import GeoIP2, GeoIP2Exception
|
from django.contrib.gis.geoip2 import GeoIP2, GeoIP2Exception
|
||||||
|
@ -90,7 +90,6 @@ class GeoIPTest(unittest.TestCase):
|
||||||
g.country(query)
|
g.country(query)
|
||||||
)
|
)
|
||||||
|
|
||||||
@skipUnless(HAS_GEOS, "Geos is required")
|
|
||||||
@mock.patch('socket.gethostbyname')
|
@mock.patch('socket.gethostbyname')
|
||||||
def test04_city(self, gethostbyname):
|
def test04_city(self, gethostbyname):
|
||||||
"GeoIP city querying methods."
|
"GeoIP city querying methods."
|
||||||
|
|
Loading…
Reference in New Issue