# HG changeset patch
# User Brodie Rao <brodie@bitheap.org>
# Date 1305680828 25200
# Branch releases/1.3.X
# Node ID 6709ee4d9f37ada03979e5bd1d7b1fc737eef936
# Parent 0ea817ff93c438044844c20b1a70ceb5c6f183f2
transaction tests: add tests for confirming autocommit/isolation level changes
diff --git a/tests/modeltests/transactions/tests.py b/tests/modeltests/transactions/tests.py
a
|
b
|
class TransactionTests(TransactionTestCa
|
165 | 165 | using_manually_managed_mistake |
166 | 166 | ) |
167 | 167 | |
| 168 | @skipUnlessDBFeature('supports_transactions') |
| 169 | def test_autocommit_enabled(self): |
| 170 | """ |
| 171 | Confirm that the default isolation level matches the |
| 172 | autocommit setting. |
| 173 | """ |
| 174 | self.assertEqual(connection.isolation_level, int(not connection.features.uses_autocommit)) |
| 175 | |
| 176 | @skipUnlessDBFeature('supports_transactions') |
| 177 | def test_autocommit_restored(self): |
| 178 | """ |
| 179 | If autocommit is enabled, the isolation level should return to |
| 180 | autocommit when leaving transaction management. |
| 181 | """ |
| 182 | |
| 183 | # The above transaction decorators do this same sort of dance. |
| 184 | transaction.enter_transaction_management() |
| 185 | transaction.managed(True) |
| 186 | transaction.leave_transaction_management() |
| 187 | self.assertEqual(connection.isolation_level, int(not connection.features.uses_autocommit)) |
| 188 | |
168 | 189 | |
169 | 190 | class TransactionRollbackTests(TransactionTestCase): |
170 | 191 | def execute_bad_sql(self): |