connection.features.supports_transactions is None
|Reported by:||Craig de Stigter||Owned by:||nobody|
|Component:||Database layer (models, ORM)||Version:||1.3|
|Cc:||Triage Stage:||Ready for checkin|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Background: To speed up our tests we have a custom nose-based test runner which *doesn't* drop/create the database. It shouldn't need to when tests are run in a transaction. This prevents us having to load fixtures etc, as most of the test data lives permanently in the database.
However after upgrading to django 1.3,
connection.features.supports_transactions is always None, causing our tests to use TRUNCATEs instead of transactions.
This appears to be because connection.features.confirm() is only called from create_test_db(): https://code.djangoproject.com/browser/django/tags/releases/1.3/django/db/backends/creation.py#L357
I'd argue that's the wrong place to do it. It should probably happen when the connection is first initialised, or at least in
(To be fair it shouldn't really be on connection.features at all, since it's only set during testing and is otherwise always None)
Tested with 1.3.1 and master.