Author: Alex
Date: 2010-10-09 01:06:24 -0500 (Sat, 09 Oct 2010)
New Revision: 14061

Modified:
   django/trunk/django/test/testcases.py
   django/trunk/tests/modeltests/get_or_create/tests.py
Log:
Fixed #12979 -- allowed using savepoints in TestCase (i.e. tests with 
transactions disabled), convert the GetOrCreate tests to use this.

Modified: django/trunk/django/test/testcases.py
===================================================================
--- django/trunk/django/test/testcases.py       2010-10-09 05:10:32 UTC (rev 
14060)
+++ django/trunk/django/test/testcases.py       2010-10-09 06:06:24 UTC (rev 
14061)
@@ -37,8 +37,6 @@
 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 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 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

Modified: django/trunk/tests/modeltests/get_or_create/tests.py
===================================================================
--- django/trunk/tests/modeltests/get_or_create/tests.py        2010-10-09 
05:10:32 UTC (rev 14060)
+++ django/trunk/tests/modeltests/get_or_create/tests.py        2010-10-09 
06:06:24 UTC (rev 14061)
@@ -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)

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to