#19678: Test failure with spatialite ------------------------+------------------------------------ Reporter: julien | Owner: nobody Type: Bug | Status: new Component: GIS | Version: 1.4 Severity: Normal | Resolution: Keywords: | Triage Stage: Accepted Has patch: 1 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 ------------------------+------------------------------------
Comment (by timo): I can reproduce this using djangocore-box: {{{ vagrant@djangocore:~$ runtests2.7-spatialite django.contrib.gis Creating test database for alias 'default'... Creating test database for alias 'other'... ..s..................sssssssssss................ssssss......................................................................................F................................Esssss....................................................................................... ====================================================================== ERROR: django.contrib.gis.tests.geoapp.tests (unittest.loader.ModuleImportFailure) ---------------------------------------------------------------------- ImportError: Failed to import test module: django.contrib.gis.tests.geoapp.tests Traceback (most recent call last): File "/usr/lib/python2.7/unittest/loader.py", line 252, in _find_tests module = self._get_module_from_name(name) File "/usr/lib/python2.7/unittest/loader.py", line 230, in _get_module_from_name __import__(name) File "/django/django/contrib/gis/tests/geoapp/tests.py", line 207, in <module> class GeoLookupTest(TestCase): File "/django/django/contrib/gis/tests/geoapp/tests.py", line 307, in GeoLookupTest if postgis_bug_version(): File "/django/django/contrib/gis/tests/geoapp/tests.py", line 27, in postgis_bug_version spatial_version = getattr(connection.ops, "spatial_version", (0,0,0)) File "/django/django/utils/functional.py", line 49, in __get__ res = instance.__dict__[self.func.__name__] = self.func(instance) File "/django/django/contrib/gis/db/backends/spatialite/operations.py", line 133, in spatial_version six.reraise(ImproperlyConfigured, ImproperlyConfigured(new_msg), sys.exc_info()[2]) File "/django/django/contrib/gis/db/backends/spatialite/operations.py", line 127, in spatial_version version = self.spatialite_version_tuple()[1:] File "/django/django/contrib/gis/db/backends/spatialite/operations.py", line 273, in spatialite_version_tuple version = self.spatialite_version() File "/django/django/contrib/gis/db/backends/spatialite/operations.py", line 264, in spatialite_version return self._get_spatialite_func('spatialite_version()') File "/django/django/contrib/gis/db/backends/spatialite/operations.py", line 242, in _get_spatialite_func cursor = self.connection._cursor() File "/django/django/db/backends/__init__.py", line 131, in _cursor self.ensure_connection() File "/django/django/db/backends/__init__.py", line 126, in ensure_connection self.connect() File "/django/django/db/backends/__init__.py", line 113, in connect conn_params = self.get_connection_params() File "/django/django/db/backends/sqlite3/base.py", line 322, in get_connection_params "settings.DATABASES is improperly configured. " ImproperlyConfigured: Cannot determine the SpatiaLite version for the "" database (error was "settings.DATABASES is improperly configured. Please supply the NAME value."). Was the SpatiaLite initialization SQL loaded on this database? ====================================================================== FAIL: test02_osr (django.contrib.gis.tests.test_spatialrefsys.SpatialRefSysTest) Testing getting OSR objects from SpatialRefSys model objects. ---------------------------------------------------------------------- Traceback (most recent call last): File "/django/django/contrib/gis/tests/test_spatialrefsys.py", line 77, in test02_osr six.assertRegex(self, srs.proj4, sd['proj4_re']) File "/django/django/utils/six.py", line 430, in assertRegex return getattr(self, _assertRegex)(*args, **kwargs) AssertionError: Regexp didn't match: '\\+proj=longlat (\\+ellps=WGS84 )?\\+datum=WGS84 \\+no_defs ' not found in u'+proj=longlat +ellps=WGS84 +towgs84=0,0,0,0,0,0,0 +no_defs ' ---------------------------------------------------------------------- Ran 266 tests in 2.289s FAILED (failures=1, errors=1, skipped=23) }}} After the patch is applied, none of the GIS tests run: {{{ vagrant@djangocore:~$ runtests2.7-spatialite django.contrib.gis Traceback (most recent call last): File "/django/tests/runtests.py", line 364, in <module> options.failfast, args) File "/django/tests/runtests.py", line 193, in django_tests state = setup(verbosity, test_labels) File "/django/tests/runtests.py", line 140, in setup test_modules = get_test_modules() File "/django/tests/runtests.py", line 67, in get_test_modules from django.contrib.gis.tests.utils import HAS_SPATIAL_DB File "/django/django/contrib/gis/tests/utils.py", line 34, in <module> from django.contrib.gis.db.backends.spatialite.models import SpatialRefSys File "/django/django/contrib/gis/db/backends/spatialite/models.py", line 45, in <module> class SpatialRefSys(models.Model, SpatialRefSysMixin): File "/django/django/contrib/gis/db/backends/spatialite/models.py", line 54, in SpatialRefSys if connection.ops.spatial_version[0] >= 3: File "/django/django/utils/functional.py", line 49, in __get__ res = instance.__dict__[self.func.__name__] = self.func(instance) File "/django/django/contrib/gis/db/backends/spatialite/operations.py", line 133, in spatial_version six.reraise(ImproperlyConfigured, ImproperlyConfigured(new_msg), sys.exc_info()[2]) File "/django/django/contrib/gis/db/backends/spatialite/operations.py", line 127, in spatial_version version = self.spatialite_version_tuple()[1:] File "/django/django/contrib/gis/db/backends/spatialite/operations.py", line 273, in spatialite_version_tuple version = self.spatialite_version() File "/django/django/contrib/gis/db/backends/spatialite/operations.py", line 264, in spatialite_version return self._get_spatialite_func('spatialite_version()') File "/django/django/contrib/gis/db/backends/spatialite/operations.py", line 242, in _get_spatialite_func cursor = self.connection._cursor() File "/django/django/db/backends/__init__.py", line 131, in _cursor self.ensure_connection() File "/django/django/db/backends/__init__.py", line 126, in ensure_connection self.connect() File "/django/django/db/backends/__init__.py", line 113, in connect conn_params = self.get_connection_params() File "/django/django/db/backends/sqlite3/base.py", line 322, in get_connection_params "settings.DATABASES is improperly configured. " django.core.exceptions.ImproperlyConfigured: Cannot determine the SpatiaLite version for the "" database (error was "settings.DATABASES is improperly configured. Please supply the NAME value."). Was the SpatiaLite initialization SQL loaded on this database? }}} -- Ticket URL: <https://code.djangoproject.com/ticket/19678#comment:9> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/064.1d88297b5ebe57857310ac17daa40b0e%40djangoproject.com. For more options, visit https://groups.google.com/groups/opt_out.