summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2010-10-09 06:06:24 +0000
committerAlex Gaynor <alex.gaynor@gmail.com>2010-10-09 06:06:24 +0000
commit80aa4432e64794bb67ce8dd6cd3e570841a901c3 (patch)
treef3503390ec90eba59a0eeedb10a21c3f4c206bfe
parentc93f5e5d0e530203048ddb6424ef43acabe17cf1 (diff)
Fixed #12979 -- allowed using savepoints in TestCase (i.e. tests with transactions disabled), convert the GetOrCreate tests to use this.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14061 bcc190cf-cafb-0310-a4f2-bffc1f526a37
-rw-r--r--django/test/testcases.py6
-rw-r--r--tests/modeltests/get_or_create/tests.py4
2 files changed, 2 insertions, 8 deletions
diff --git a/django/test/testcases.py b/django/test/testcases.py
index 58c26c8b71..90319a72e9 100644
--- a/django/test/testcases.py
+++ b/django/test/testcases.py
@@ -37,8 +37,6 @@ real_commit = transaction.commit
real_rollback = transaction.rollback
real_enter_transaction_management = transaction.enter_transaction_management
real_leave_transaction_management = transaction.leave_transaction_management
-real_savepoint_commit = transaction.savepoint_commit
-real_savepoint_rollback = transaction.savepoint_rollback
real_managed = transaction.managed
def nop(*args, **kwargs):
@@ -47,8 +45,6 @@ def nop(*args, **kwargs):
def disable_transaction_methods():
transaction.commit = nop
transaction.rollback = nop
- transaction.savepoint_commit = nop
- transaction.savepoint_rollback = nop
transaction.enter_transaction_management = nop
transaction.leave_transaction_management = nop
transaction.managed = nop
@@ -56,8 +52,6 @@ def disable_transaction_methods():
def restore_transaction_methods():
transaction.commit = real_commit
transaction.rollback = real_rollback
- transaction.savepoint_commit = real_savepoint_commit
- transaction.savepoint_rollback = real_savepoint_rollback
transaction.enter_transaction_management = real_enter_transaction_management
transaction.leave_transaction_management = real_leave_transaction_management
transaction.managed = real_managed
diff --git a/tests/modeltests/get_or_create/tests.py b/tests/modeltests/get_or_create/tests.py
index 1999b20c76..3323c88a82 100644
--- a/tests/modeltests/get_or_create/tests.py
+++ b/tests/modeltests/get_or_create/tests.py
@@ -1,12 +1,12 @@
from datetime import date
from django.db import IntegrityError
-from django.test import TransactionTestCase
+from django.test import TestCase
from models import Person, ManualPrimaryKeyTest
-class GetOrCreateTests(TransactionTestCase):
+class GetOrCreateTests(TestCase):
def test_get_or_create(self):
p = Person.objects.create(
first_name='John', last_name='Lennon', birthday=date(1940, 10, 9)