Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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...
commit 80aa4432e64794bb67ce8dd6cd3e570841a901c3 1 parent c93f5e5
Alex Gaynor authored October 09, 2010
6  django/test/testcases.py
@@ -37,8 +37,6 @@ def to_list(value):
37 37
 real_rollback = transaction.rollback
38 38
 real_enter_transaction_management = transaction.enter_transaction_management
39 39
 real_leave_transaction_management = transaction.leave_transaction_management
40  
-real_savepoint_commit = transaction.savepoint_commit
41  
-real_savepoint_rollback = transaction.savepoint_rollback
42 40
 real_managed = transaction.managed
43 41
 
44 42
 def nop(*args, **kwargs):
@@ -47,8 +45,6 @@ def nop(*args, **kwargs):
47 45
 def disable_transaction_methods():
48 46
     transaction.commit = nop
49 47
     transaction.rollback = nop
50  
-    transaction.savepoint_commit = nop
51  
-    transaction.savepoint_rollback = nop
52 48
     transaction.enter_transaction_management = nop
53 49
     transaction.leave_transaction_management = nop
54 50
     transaction.managed = nop
@@ -56,8 +52,6 @@ def disable_transaction_methods():
56 52
 def restore_transaction_methods():
57 53
     transaction.commit = real_commit
58 54
     transaction.rollback = real_rollback
59  
-    transaction.savepoint_commit = real_savepoint_commit
60  
-    transaction.savepoint_rollback = real_savepoint_rollback
61 55
     transaction.enter_transaction_management = real_enter_transaction_management
62 56
     transaction.leave_transaction_management = real_leave_transaction_management
63 57
     transaction.managed = real_managed
4  tests/modeltests/get_or_create/tests.py
... ...
@@ -1,12 +1,12 @@
1 1
 from datetime import date
2 2
 
3 3
 from django.db import IntegrityError
4  
-from django.test import TransactionTestCase
  4
+from django.test import TestCase
5 5
 
6 6
 from models import Person, ManualPrimaryKeyTest
7 7
 
8 8
 
9  
-class GetOrCreateTests(TransactionTestCase):
  9
+class GetOrCreateTests(TestCase):
10 10
     def test_get_or_create(self):
11 11
         p = Person.objects.create(
12 12
             first_name='John', last_name='Lennon', birthday=date(1940, 10, 9)

0 notes on commit 80aa443

Please sign in to comment.
Something went wrong with that request. Please try again.