From 4c6ddaf7e37429a758187d15406744509f94c813 Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Thu, 4 Apr 2024 22:18:20 +0100 Subject: [PATCH] Try workaround --- quicktest.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/quicktest.py b/quicktest.py index f22dbed..78dae8a 100644 --- a/quicktest.py +++ b/quicktest.py @@ -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)