Added gis_tests.utils.mariadb hook.
This commit is contained in:
parent
ef4beafa2c
commit
bebf61de11
|
@ -12,7 +12,7 @@ from django.db import NotSupportedError, connection
|
||||||
from django.db.models import Sum
|
from django.db.models import Sum
|
||||||
from django.test import TestCase, skipUnlessDBFeature
|
from django.test import TestCase, skipUnlessDBFeature
|
||||||
|
|
||||||
from ..utils import FuncTestMixin, mysql, oracle, postgis, spatialite
|
from ..utils import FuncTestMixin, mariadb, mysql, oracle, postgis, spatialite
|
||||||
from .models import City, Country, CountryWebMercator, State, Track
|
from .models import City, Country, CountryWebMercator, State, Track
|
||||||
|
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ class GISFunctionsTests(FuncTestMixin, TestCase):
|
||||||
# WHERE "geoapp_city"."name" = 'Chicago';
|
# WHERE "geoapp_city"."name" = 'Chicago';
|
||||||
# Finally, we set every available keyword.
|
# Finally, we set every available keyword.
|
||||||
# MariaDB doesn't limit the number of decimals in bbox.
|
# MariaDB doesn't limit the number of decimals in bbox.
|
||||||
if mysql and connection.mysql_is_mariadb:
|
if mariadb:
|
||||||
chicago_json['bbox'] = [-87.650175, 41.850385, -87.650175, 41.850385]
|
chicago_json['bbox'] = [-87.650175, 41.850385, -87.650175, 41.850385]
|
||||||
self.assertJSONEqual(
|
self.assertJSONEqual(
|
||||||
City.objects.annotate(
|
City.objects.annotate(
|
||||||
|
|
|
@ -13,7 +13,8 @@ from django.db import NotSupportedError, connection
|
||||||
from django.test import TestCase, skipUnlessDBFeature
|
from django.test import TestCase, skipUnlessDBFeature
|
||||||
|
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
mysql, no_oracle, oracle, postgis, skipUnlessGISLookup, spatialite,
|
mariadb, mysql, no_oracle, oracle, postgis, skipUnlessGISLookup,
|
||||||
|
spatialite,
|
||||||
)
|
)
|
||||||
from .models import (
|
from .models import (
|
||||||
City, Country, Feature, MinusOneSRID, NonConcreteModel, PennsylvaniaCity,
|
City, Country, Feature, MinusOneSRID, NonConcreteModel, PennsylvaniaCity,
|
||||||
|
@ -227,8 +228,7 @@ class GeoLookupTest(TestCase):
|
||||||
|
|
||||||
def test_disjoint_lookup(self):
|
def test_disjoint_lookup(self):
|
||||||
"Testing the `disjoint` lookup type."
|
"Testing the `disjoint` lookup type."
|
||||||
if (connection.vendor == 'mysql' and not connection.mysql_is_mariadb and
|
if mysql and not mariadb and connection.mysql_version < (8, 0, 0):
|
||||||
connection.mysql_version < (8, 0, 0)):
|
|
||||||
raise unittest.SkipTest('MySQL < 8 gives different results.')
|
raise unittest.SkipTest('MySQL < 8 gives different results.')
|
||||||
ptown = City.objects.get(name='Pueblo')
|
ptown = City.objects.get(name='Pueblo')
|
||||||
qs1 = City.objects.filter(point__disjoint=ptown.point)
|
qs1 = City.objects.filter(point__disjoint=ptown.point)
|
||||||
|
|
|
@ -10,7 +10,7 @@ from django.test import SimpleTestCase, TestCase, skipUnlessDBFeature
|
||||||
from django.test.utils import modify_settings
|
from django.test.utils import modify_settings
|
||||||
|
|
||||||
from ..test_data import TEST_DATA
|
from ..test_data import TEST_DATA
|
||||||
from ..utils import postgis
|
from ..utils import mariadb, postgis
|
||||||
from .models import AllOGRFields
|
from .models import AllOGRFields
|
||||||
|
|
||||||
|
|
||||||
|
@ -141,7 +141,7 @@ class OGRInspectTest(SimpleTestCase):
|
||||||
else:
|
else:
|
||||||
self.assertIn(' f_decimal = models.DecimalField(max_digits=0, decimal_places=0)', model_def)
|
self.assertIn(' f_decimal = models.DecimalField(max_digits=0, decimal_places=0)', model_def)
|
||||||
self.assertIn(' f_int = models.IntegerField()', model_def)
|
self.assertIn(' f_int = models.IntegerField()', model_def)
|
||||||
if connection.vendor != 'mysql' or not connection.mysql_is_mariadb:
|
if not mariadb:
|
||||||
# Probably a bug between GDAL and MariaDB on time fields.
|
# Probably a bug between GDAL and MariaDB on time fields.
|
||||||
self.assertIn(' f_datetime = models.DateTimeField()', model_def)
|
self.assertIn(' f_datetime = models.DateTimeField()', model_def)
|
||||||
self.assertIn(' f_time = models.TimeField()', model_def)
|
self.assertIn(' f_time = models.TimeField()', model_def)
|
||||||
|
|
|
@ -46,6 +46,7 @@ _default_db = settings.DATABASES[DEFAULT_DB_ALIAS]['ENGINE'].rsplit('.')[-1]
|
||||||
oracle = _default_db == 'oracle'
|
oracle = _default_db == 'oracle'
|
||||||
postgis = _default_db == 'postgis'
|
postgis = _default_db == 'postgis'
|
||||||
mysql = _default_db == 'mysql'
|
mysql = _default_db == 'mysql'
|
||||||
|
mariadb = mysql and connection.mysql_is_mariadb
|
||||||
spatialite = _default_db == 'spatialite'
|
spatialite = _default_db == 'spatialite'
|
||||||
|
|
||||||
# MySQL spatial indices can't handle NULL geometries.
|
# MySQL spatial indices can't handle NULL geometries.
|
||||||
|
|
Loading…
Reference in New Issue