Author: ramiro
Date: 2011-09-04 15:51:53 -0700 (Sun, 04 Sep 2011)
New Revision: 16722

Modified:
   django/trunk/django/test/utils.py
   django/trunk/tests/regressiontests/settings_tests/tests.py
Log:
Also copy `__module__` to our dynamically created TestCase subclass when 
override_settings acts as a class decorator.

Otherwise, an error in e.g. a test in 
tests/modeltests/proxy_model_inheritance/tests.py
was being reported as:

ERROR: test_table_exists (django.test.utils.ProxyModelInheritanceTests)

Refs #16672 and [16650].

Modified: django/trunk/django/test/utils.py
===================================================================
--- django/trunk/django/test/utils.py   2011-09-04 22:42:11 UTC (rev 16721)
+++ django/trunk/django/test/utils.py   2011-09-04 22:51:53 UTC (rev 16722)
@@ -211,6 +211,7 @@
                 {
                     '_pre_setup': _pre_setup,
                     '_post_teardown': _post_teardown,
+                    '__module__': test_func.__module__,
                 })
         else:
             @wraps(test_func)

Modified: django/trunk/tests/regressiontests/settings_tests/tests.py
===================================================================
--- django/trunk/tests/regressiontests/settings_tests/tests.py  2011-09-04 
22:42:11 UTC (rev 16721)
+++ django/trunk/tests/regressiontests/settings_tests/tests.py  2011-09-04 
22:51:53 UTC (rev 16722)
@@ -18,6 +18,9 @@
     def test_decorated_testcase_name(self):
         self.assertEquals(FullyDecoratedTranTestCase.__name__, 
'FullyDecoratedTranTestCase')
 
+    def test_decorated_testcase_module(self):
+        self.assertEquals(FullyDecoratedTranTestCase.__module__, __name__)
+
 FullyDecoratedTranTestCase = 
override_settings(TEST='override')(FullyDecoratedTranTestCase)
 
 # @override_settings(TEST='override')

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

Reply via email to