﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
1763	Patch to enable in-memory testing of Django applications	crankycoder@…	Adrian Holovaty	"Currently, Django doesn't have a nice way of unit-testing individual applications quickly it takes a long time to drop/recreate the backing database.  There are a number of scripts on the web that *almost* let you replace the database with a SQLite in-memory database, but it doesn't work in all cases due to some tricky import problems in Django.

Basically - after the MR branch was merged, the following idiom crept into a lot of the Django code:

{{{
from django.db import connection
}}}

Unfortunately, in Python, that means that every module that invokes that line will create a module local reference to the connection.  If the db module is reloaded with a sqlite in-memory database, all of the caller of ""from django.db import connection"" will *not* get the new database connection.

I have a patch for Django that will let you cleanly replace the django.db module in one shot.

"	defect	closed	Database layer (models, ORM)		normal	wontfix		gabor@…	Unreviewed	0	0	0	0	0	0
