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
18813 TEST_MIRROR functionality broken for sqlite adsva nobody "I do understand that SQLite doesn't really support replication, so the test_mirror setting might be a little silly, but I'm using postgres with a master/slave setup in production and would like to use SQLite when running the tests for simplicity and performance. Following what seems like a somewhat common practice of switching the DATABASES setting for testing:
{{{
if 'test' in sys.argv:
DATABASES = {
""default"": {
""ENGINE"": ""django.db.backends.sqlite3"",
},
""slave"": {
""ENGINE"": ""django.db.backends.sqlite3"",
'TEST_MIRROR': 'default',
},
}
}}}
But when I try to use `connections['slave']` after database initialization is done in the test runner I get an uninitialized in-memory database, and not the `connections['default']` database. The reason seems to be that the test runner just copies the name and features of the 'default' connection to the 'slave' connection. I guess this is sufficient for the other database engines, where the name ensures the connections use the same database, but each SQLite connection to ':memory:' gets its own database.
The attached patch changes that behavior to simply point `connections['slave']` to `connections['master']`, and that seems to solve the problem, but maybe there was good reason for the current behavior?" Bug closed Testing framework 1.4 Normal wontfix Unreviewed 1 0 0 0 0 0