Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#19296 closed Bug (fixed)

LiveServerTestCase does not share connection to sqlite if using spatialite

Reported by: pegler@… Owned by: Claude Paroz
Component: Testing framework Version: 1.4
Severity: Normal Keywords: sqlite spatialite LiveServerTestCase
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Like the title says, if the database backend is set to 'django.contrib.gis.db.backends.spatialite' instead of 'django.db.backends.sqlite3' it doesn't properly share the connection with the new threads when using LiveServerTestCase. See: https://github.com/django/django/blob/82b3e6ffcb9d810cc0e3ec27d25f89ce1fd525e0/django/test/testcases.py#L1080

Attachments (1)

patch.diff (771 bytes) - added by Matt 4 years ago.
patch to also support spatialite

Download all attachments as: .zip

Change History (8)

comment:1 Changed 4 years ago by Julien Phalip

Triage Stage: UnreviewedAccepted
Type: UncategorizedBug

comment:2 Changed 4 years ago by Matt

Owner: changed from nobody to Matt

Changed 4 years ago by Matt

Attachment: patch.diff added

patch to also support spatialite

comment:3 Changed 4 years ago by Matt

Has patch: set

I added a patch that fixes this. I was unsure how to write a test for this. Conceivably the test could start a LiveServer and override the default database to be spatialite and then make sure that a particular view loads data from the DB correctly. This test is in core and geodjango is in contrib, so I was not sure where the test should go or if it was reasonable to require spatialite be installed in order to run the tests of django core. Please advise on what test is required for this.

comment:4 Changed 4 years ago by Claude Paroz

Owner: changed from Matt to Claude Paroz

I'm not convinced this needs testing. Thanks for your patch, I will commit something soon.

comment:5 Changed 4 years ago by Claude Paroz <claude@…>

Resolution: fixed
Status: newclosed

In ff0d3126afbc30ae1aab3a9d352300e59937fe5e:

Fixed #19296 -- Applied test connection sharing for spatialite

Thanks pegler at gmail.com for the report and the initial patch.

comment:6 Changed 4 years ago by Claude Paroz <claude@…>

In b39b0aedbfbddf8fab0c43b92dc237caa8da375f:

[1.5.x] Fixed #19296 -- Applied test connection sharing for spatialite

Thanks pegler at gmail.com for the report and the initial patch.
Backport of ff0d3126af from master.

comment:7 Changed 4 years ago by Preston Holmes <preston@…>

In 49fb402edfa3f40eb9e9345447edb85c0a8c4dac:

Fixed #19296 -- Applied test connection sharing for spatialite

Thanks pegler at gmail.com for the report and the initial patch.

Note: See TracTickets for help on using tickets.
Back to Top