Fixed #17760 -- Implemented callable database features as cached properties

This does remove the requirement to call features.confirm() method
before checking the properties.
Thanks cdestiger and Ramiro Morales for their work on the patch.
This commit is contained in:
Claude Paroz 2012-06-09 15:59:52 +02:00
parent 484fcd34a4
commit aa423575e7
7 changed files with 29 additions and 47 deletions

View file

@ -403,8 +403,7 @@ class BackendTestCase(TestCase):
self.assertTrue(hasattr(connection.ops, 'connection'))
self.assertEqual(connection, connection.ops.connection)
def test_supports_needed_confirm(self):
connection.features.confirm()
def test_cached_db_features(self):
self.assertIn(connection.features.supports_transactions, (True, False))
self.assertIn(connection.features.supports_stddev, (True, False))
self.assertIn(connection.features.can_introspect_foreign_keys, (True, False))