From 498ae3a36069e2dfa4e041eeddb40278ea907c76 Mon Sep 17 00:00:00 2001 From: Thomas Chaumeny Date: Sun, 9 Nov 2014 22:24:22 +0100 Subject: [PATCH] Removed legacy code from old transaction system --- django/test/testcases.py | 25 +------------------------ 1 file changed, 1 insertion(+), 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)