#11867: if spatialite is installed and pysqlite2.5 is installed without
`enable_load_extension` tests won't run
-----------------------------------+----------------------------------------
 Reporter:  danring                |       Owner:  nobody    
   Status:  new                    |   Milestone:            
Component:  GIS                    |     Version:  1.1       
 Keywords:  enable_load_extension  |       Stage:  Unreviewed
Has_patch:  0                      |  
-----------------------------------+----------------------------------------
 Using spatialite with contrib.gis is supported only with pysqlite2.5.0 or
 higher, and pysqlite must be compiled with `enable_load_extension` support
 (see http://geodjango.org/docs/install.html#pysqlite2 ).  If spatialite is
 present, `settings.DATABASE_ENGINE == 'sqlite3'`, and pysqlite is present
 but without `enable_load_extension` support, tests/runtests.py fails as
 follows:

 {{{
 Traceback (most recent call last):
   File "./runtests.py", line 191, in <module>
     django_tests(int(options.verbosity), options.interactive, args)
   File "./runtests.py", line 161, in django_tests
     failures = test_runner(test_labels, verbosity=verbosity,
 interactive=interactive, extra_tests=extra_tests)
   File "/home/dan/work/django/django/django/test/simple.py", line 191, in
 run_tests
     connection.creation.create_test_db(verbosity, autoclobber=not
 interactive)
   File "/home/dan/work/django/django/django/db/backends/creation.py", line
 332, in create_test_db
     can_rollback = self._rollback_works()
   File "/home/dan/work/django/django/django/db/backends/creation.py", line
 389, in _rollback_works
     cursor = self.connection.cursor()
   File "/home/dan/work/django/django/django/db/backends/__init__.py", line
 81, in cursor
     cursor = self._cursor()
   File "/home/dan/work/django/django/django/db/backends/sqlite3/base.py",
 line 175, in _cursor
     connection_created.send(sender=self.__class__)
   File "/home/dan/work/django/django/django/dispatch/dispatcher.py", line
 166, in send
     response = receiver(signal=self, sender=sender, **named)
   File
 
"/home/dan/work/django/django/django/contrib/gis/db/backend/spatialite/__init__.py",
 line 26, in initialize_spatialite
     connection.connection.enable_load_extension(True)
 AttributeError: 'sqlite3.Connection' object has no attribute
 'enable_load_extension'
 }}}

 Note that this is not a test failure, but rather a failure of any tests to
 run at all.

 Also, Debian package python-pysqlite2 (currently) defaults to disabling
 `enable_load_extension`.  (See: http://bugs.debian.org/cgi-
 bin/bugreport.cgi?bug=543252 )

 I think either

 1. `settings.DATABASE_ENGINE='spatialite'` instead of `'sqlite3'` should
 be used (my preference) (or maybe `sqlite3_spatialite` or something); or

 2. `contrib.gis.tests.utils.spatialite` should only be set if
 `enable_load_extension` is available (`contrib.gis` tests should be
 skipped somehow).

-- 
Ticket URL: <http://code.djangoproject.com/ticket/11867>
Django <http://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 post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to