Opened 18 years ago
Closed 18 years ago
#2658 closed defect (fixed)
Test suite fails using SQLite in memory database
Reported by: | Russell Keith-Magee | Owned by: | Russell Keith-Magee |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 0.95 |
Severity: | normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Ned Batchelder reports that when using the SQLite backend on [3708], the test_client modeltests closes the database cursor, which causes all the database schema to be lost.
Modifying backends/sqlite3/base.py to the following:
def close(self): from django.conf import settings if self.connection is not None and settings.DATABASE_NAME != ":memory:": self.connection.close() self.connection = None
fixes the problem.
Note:
See TracTickets
for help on using tickets.
(In [3723]) Fixes #2658 -- Modified SQLite cursor close() method for in-memory databases, making the lifespan of an in-memory database equal to the life of the process, rather than the life of the cursor. Thanks, Ned Batchelder.