summaryrefslogtreecommitdiff
path: root/django/test
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2013-03-02 13:47:46 +0100
committerAymeric Augustin <aymeric.augustin@m4x.org>2013-03-11 14:48:53 +0100
commitf5156194945661d217523d6648dfb9b48707ec95 (patch)
tree0645efea9da4a6e2aff7c3537cb5d4bcf2fc3117 /django/test
parent7aacde84f2b499d9c35741cbfccb621af6b48903 (diff)
downloaddjango-f5156194945661d217523d6648dfb9b48707ec95.tar.gz
Added an API to control database-level autocommit.
Diffstat (limited to 'django/test')
-rw-r--r--django/test/testcases.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/django/test/testcases.py b/django/test/testcases.py
index 7f6b1a49ba..4b9116e3bc 100644
--- a/django/test/testcases.py
+++ b/django/test/testcases.py
@@ -63,6 +63,7 @@ def to_list(value):
value = [value]
return value
+real_set_autocommit = transaction.set_autocommit
real_commit = transaction.commit
real_rollback = transaction.rollback
real_enter_transaction_management = transaction.enter_transaction_management
@@ -73,6 +74,7 @@ def nop(*args, **kwargs):
return
def disable_transaction_methods():
+ transaction.set_autocommit = nop
transaction.commit = nop
transaction.rollback = nop
transaction.enter_transaction_management = nop
@@ -80,6 +82,7 @@ def disable_transaction_methods():
transaction.abort = nop
def restore_transaction_methods():
+ transaction.set_autocommit = real_set_autocommit
transaction.commit = real_commit
transaction.rollback = real_rollback
transaction.enter_transaction_management = real_enter_transaction_management