Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#19296 closed Bug (fixed)

LiveServerTestCase does not share connection to sqlite if using spatialite

Reported by: pegler@… Owned by: claudep
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 pegler 3 years ago.
patch to also support spatialite

Download all attachments as: .zip

Change History (8)

comment:1 Changed 3 years ago by julien

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted
  • Type changed from Uncategorized to Bug

comment:2 Changed 3 years ago by pegler

  • Owner changed from nobody to pegler

Changed 3 years ago by pegler

patch to also support spatialite

comment:3 Changed 3 years ago by pegler

  • 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 3 years ago by claudep

  • Owner changed from pegler to claudep

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

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

  • Resolution set to fixed
  • Status changed from new to closed

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 3 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 3 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