connection.features.supports_transactions is None
|Reported by:||cdestigter||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 TestCase._pre_setup()
(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.
Change History (14)
comment:1 Changed 3 years ago by cdestigter
- Has patch set
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
Changed 3 years ago by cdestigter
Changed 3 years ago by ramiro
comment:8 Changed 3 years ago by Claude Paroz <claude@…>
- Resolution set to fixed
- Status changed from new to closed