Permalink
Browse files

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
  • Loading branch information...
1 parent c93f5e5 commit 80aa4432e64794bb67ce8dd6cd3e570841a901c3 @alex alex committed Oct 9, 2010
Showing with 2 additions and 8 deletions.
  1. +0 −6 django/test/testcases.py
  2. +2 −2 tests/modeltests/get_or_create/tests.py
View
6 django/test/testcases.py
@@ -37,8 +37,6 @@ def to_list(value):
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,17 +45,13 @@ 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
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
View
4 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)

0 comments on commit 80aa443

Please sign in to comment.