Author: ramiro
Date: 2011-08-10 15:26:34 -0700 (Wed, 10 Aug 2011)
New Revision: 16592

Modified:
   django/trunk/django/test/utils.py
   django/trunk/tests/regressiontests/settings_tests/tests.py
Log:
Made override_settings also work with TransactionTestCase when acting as a 
class decorator.

Modified: django/trunk/django/test/utils.py
===================================================================
--- django/trunk/django/test/utils.py   2011-08-08 17:08:35 UTC (rev 16591)
+++ django/trunk/django/test/utils.py   2011-08-10 22:26:34 UTC (rev 16592)
@@ -194,8 +194,8 @@
         self.disable()
 
     def __call__(self, test_func):
-        from django.test import TestCase
-        if isinstance(test_func, type) and issubclass(test_func, TestCase):
+        from django.test import TransactionTestCase
+        if isinstance(test_func, type) and issubclass(test_func, 
TransactionTestCase):
             class inner(test_func):
                 def _pre_setup(innerself):
                     self.enable()

Modified: django/trunk/tests/regressiontests/settings_tests/tests.py
===================================================================
--- django/trunk/tests/regressiontests/settings_tests/tests.py  2011-08-08 
17:08:35 UTC (rev 16591)
+++ django/trunk/tests/regressiontests/settings_tests/tests.py  2011-08-10 
22:26:34 UTC (rev 16592)
@@ -1,11 +1,23 @@
 from __future__ import with_statement
 import os
 from django.conf import settings, global_settings
-from django.test import TestCase, signals
+from django.test import TransactionTestCase, TestCase, signals
 from django.test.utils import override_settings
 
 
 # @override_settings(TEST='override')
+class FullyDecoratedTranTestCase(TransactionTestCase):
+
+    def test_override(self):
+        self.assertEqual(settings.TEST, 'override')
+
+    @override_settings(TEST='override2')
+    def test_method_override(self):
+        self.assertEqual(settings.TEST, 'override2')
+
+FullyDecoratedTranTestCase = 
override_settings(TEST='override')(FullyDecoratedTranTestCase)
+
+# @override_settings(TEST='override')
 class FullyDecoratedTestCase(TestCase):
 
     def test_override(self):

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@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