* status: closed => new
* severity: => Normal
* type: => Uncategorized
* easy: => 0
* ui_ux: => 0
* resolution: invalid =>
Comment:
I vote to reopen this.
sqlite, as of version 3.7.13 (released 2012-06-11) has the ability to
share an in-memory database between multiple connections and threads.
See: http://www.sqlite.org/releaselog/3_7_13.html
Making this work with the Django testing framework should be pretty easy:
In the sqlite database backend, instead of using the database name
`:memory:`, we should use a name such as
`file:testdb?mode=memory&cache=shared` (where "testdb" can be anything and
ideally should be unique so that multiple tests can run concurrently, each
with its own individual database).
As a bonus, doing this should allow removing the hacky sqlite-specific
code from "LiveServerTestCase" (It contains a messy workaround for exactly
the issue of this bug report)
The only thing that might be a little tricky is making this update in the
Django code to still support older vesions of sqlite by falling back to
the current behavior (`:memory:`), but I imagine that this shouldn't be
too difficult.
--
Ticket URL: <https://code.djangoproject.com/ticket/12118#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* stage: Unreviewed => Accepted
--
Ticket URL: <https://code.djangoproject.com/ticket/12118#comment:3>
* version: 1.1 => master
* type: Uncategorized => New feature
--
Ticket URL: <https://code.djangoproject.com/ticket/12118#comment:4>
* status: new => assigned
* owner: nobody => coldmind
--
Ticket URL: <https://code.djangoproject.com/ticket/12118#comment:5>
* has_patch: 0 => 1
Comment:
Pull request here: https://github.com/django/django/pull/3677
--
Ticket URL: <https://code.djangoproject.com/ticket/12118#comment:6>
* needs_better_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/12118#comment:7>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"8c99b7920e8187f98cf4d7dbd9918bd6c6da1238"]:
{{{
#!CommitTicketReference repository=""
revision="8c99b7920e8187f98cf4d7dbd9918bd6c6da1238"
Fixed #12118 -- Added shared cache support to SQLite in-memory testing.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/12118#comment:8>
Comment (by hjwp):
Incidentally, in case it's of use to anyone else that's temporarily stuck
on an earlier versions of django, you can hack a workaround for this by
using a path in `/dev/shm` in `TEST_NAME`:
{{{
DATABASES['default']['TEST_NAME'] = '/dev/shm/myproject-
djangotestdb.sqlite'
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/12118#comment:9>
Comment (by Tim Graham <timograham@…>):
In [changeset:"3543fec3b739864c52de0a116dde3b0e5e885799" 3543fec3]:
{{{
#!CommitTicketReference repository=""
revision="3543fec3b739864c52de0a116dde3b0e5e885799"
Refs #12118 -- Allowed "mode=memory" in SQLite test database names.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/12118#comment:10>
Comment (by Tim Graham <timograham@…>):
In [changeset:"6f653f759ac2ba735bf8fa3fbb634a431288c041" 6f653f75]:
{{{
#!CommitTicketReference repository=""
revision="6f653f759ac2ba735bf8fa3fbb634a431288c041"
[1.9.x] Refs #12118 -- Allowed "mode=memory" in SQLite test database
names.
Backport of 3543fec3b739864c52de0a116dde3b0e5e885799 from master
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/12118#comment:11>
Comment (by Tim Graham <timograham@…>):
In [changeset:"e2db171e15b8d7d924cc4b1e0c67c96478c2644b" e2db171e]:
{{{
#!CommitTicketReference repository=""
revision="e2db171e15b8d7d924cc4b1e0c67c96478c2644b"
[1.8.x] Refs #12118 -- Allowed "mode=memory" in SQLite test database
names.
Backport of 3543fec3b739864c52de0a116dde3b0e5e885799 from master
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/12118#comment:12>
* status: new => closed
* resolution: => fixed
Comment:
Please don't reopen old tickets. You can create a new ticket, but Django
1.11 is no longer supported so you need to first confirm this issue in
Django 3.1+.
--
Ticket URL: <https://code.djangoproject.com/ticket/12118#comment:14>