summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Chaumeny <t.chaumeny@gmail.com>2014-11-09 22:24:22 +0100
committerThomas Chaumeny <t.chaumeny@gmail.com>2014-11-10 18:28:46 +0100
commit498ae3a36069e2dfa4e041eeddb40278ea907c76 (patch)
tree4ab5fc5960459eb831e21cf920265b4635facf1a
parent88b2a20f047347da86f448fe09a56251d29e4168 (diff)
Removed legacy code from old transaction system
-rw-r--r--django/test/testcases.py25
1 files changed, 1 insertions, 24 deletions
diff --git a/django/test/testcases.py b/django/test/testcases.py
index 8d3265a5b9..837c843ff5 100644
--- a/django/test/testcases.py
+++ b/django/test/testcases.py
@@ -58,24 +58,6 @@ def to_list(value):
value = [value]
return value
-real_commit = transaction.commit
-real_rollback = transaction.rollback
-
-
-def nop(*args, **kwargs):
- return
-
-
-def disable_transaction_methods():
- transaction.commit = nop
- transaction.rollback = nop
-
-
-def restore_transaction_methods():
- transaction.commit = real_commit
- transaction.rollback = real_rollback
-
-
def assert_and_parse_html(self, html, user_msg, msg):
try:
dom = parse_html(html)
@@ -933,8 +915,6 @@ class TestCase(TransactionTestCase):
for db_name in self._databases_names():
self.atomics[db_name] = transaction.atomic(using=db_name)
self.atomics[db_name].__enter__()
- # Remove this when the legacy transaction management goes away.
- disable_transaction_methods()
for db_name in self._databases_names(include_mirrors=False):
if self.fixtures:
@@ -953,11 +933,8 @@ class TestCase(TransactionTestCase):
if not connections_support_transactions():
return super(TestCase, self)._fixture_teardown()
- # Remove this when the legacy transaction management goes away.
- restore_transaction_methods()
for db_name in reversed(self._databases_names()):
- # Hack to force a rollback
- connections[db_name].needs_rollback = True
+ transaction.set_rollback(True, using=db_name)
self.atomics[db_name].__exit__(None, None, None)