Description

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.

I think the connection.features.supports_transactions should be a cached property. It checks the support when first accessed, later on it is just a normal boolean. That way there would be no need to run features.confirm() at all, supports transactions is always usable.

There is a @cached_property decorator at django/utils/functional.py, it is meant for situations like this. Maybe it would make the implementation a bit cleaner.

You could perhaps test that no queries are made after first use of the property, but if you use the @cached_property decorator, I don't know how necessary that is. It might be better to write a test for the @cached_property decorator, and then trust that it does the right thing. In short, I don't know if there is any need for additional tests.