Skip to content

Commit

Permalink
4.0+ only
Browse files Browse the repository at this point in the history
  • Loading branch information
adamchainz committed Apr 4, 2024
1 parent 73587dc commit f301744
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
18 changes: 8 additions & 10 deletions quicktest.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,16 @@ def run_tests(self):
django.setup()

# Workaround
if django.VERSION >= (4, 0):
from django.contrib.gis.db.backends.spatialite.base import DatabaseWrapper

from django.contrib.gis.db.backends.spatialite.base import DatabaseWrapper
def prepare_database(self):
super(DatabaseWrapper, self).prepare_database()
with self.cursor() as cursor:
cursor.execute("PRAGMA table_info(geometry_columns);")
if cursor.fetchall() == []:
cursor.execute("SELECT InitSpatialMetaData(1)")

def prepare_database(self):
super(DatabaseWrapper, self).prepare_database()
with self.cursor() as cursor:
cursor.execute("PRAGMA table_info(geometry_columns);")
if cursor.fetchall() == []:
cursor.execute("SELECT InitSpatialMetaData(1)")

DatabaseWrapper.prepare_database = prepare_database
DatabaseWrapper.prepare_database = prepare_database

failures = DiscoverRunner().run_tests(self.apps, verbosity=1)
if failures: # pragma: no cover
Expand Down
7 changes: 3 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ skipsdist = True
envlist =
flake8
isort
py38-django{32,40,41,42}
py39-django{32,40,41,42}
py310-django{32,40,41,42,50}
py38-django{40,41,42}
py39-django{40,41,42}
py310-django{40,41,42,50}
py311-django{41,42,50}
py312-django{42,50}

Expand All @@ -14,7 +14,6 @@ setenv =
PYTHONPATH = {toxinidir}:{toxinidir}
deps =
coverage
django32: Django>=3.2,<4.0
django40: Django>=4.0,<4.1
django41: Django>=4.1,<4.2
django42: Django>=4.2,<5.0
Expand Down

0 comments on commit f301744

Please sign in to comment.