Skip to content

Commit

Permalink
Try workaround
Browse files Browse the repository at this point in the history
  • Loading branch information
adamchainz committed Apr 4, 2024
1 parent e898285 commit 11b9b72
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
4 changes: 2 additions & 2 deletions djgeojson/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -679,9 +679,9 @@ def test_within_viewport(self):
response = self.view.render_to_response(context={})
geojson = json.loads(smart_str(response.content))
self.assertEqual(len(geojson['features']), 2)
self.assertAlmostEqual(geojson['features'][0]['geometry']['coordinates'][0], 6.843322039261242)
self.assertAlmostEqual(geojson['features'][0]['geometry']['coordinates'][0], 6.843321961076886)
self.assertAlmostEqual(geojson['features'][0]['geometry']['coordinates'][1], 52.76181518632031)
self.assertAlmostEqual(geojson['features'][1]['geometry']['coordinates'][0], 6.846053318324978)
self.assertAlmostEqual(geojson['features'][1]['geometry']['coordinates'][0], 6.846053240233331 )
self.assertAlmostEqual(geojson['features'][1]['geometry']['coordinates'][1], 52.77442791046052)


Expand Down
11 changes: 11 additions & 0 deletions quicktest.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,17 @@ def run_tests(self):

django.setup()

# Workaround

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("SELECT InitSpatialMetaData(1)")

DatabaseWrapper.prepare_database = prepare_database

failures = DiscoverRunner().run_tests(self.apps, verbosity=1)
if failures: # pragma: no cover
sys.exit(failures)
Expand Down

0 comments on commit 11b9b72

Please sign in to comment.