Permalink
Browse files

Also copy `__module__` to our dynamically created TestCase subclass w…

…hen 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].

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16722 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
1 parent efd682e commit 2b4341d532b376702a17212a9ff9f8710ca4c14a @ramiro ramiro committed Sep 4, 2011
Showing with 4 additions and 0 deletions.
  1. +1 −0 django/test/utils.py
  2. +3 −0 tests/regressiontests/settings_tests/tests.py
View
1 django/test/utils.py
@@ -211,6 +211,7 @@ def _post_teardown(innerself):
{
'_pre_setup': _pre_setup,
'_post_teardown': _post_teardown,
+ '__module__': test_func.__module__,
})
else:
@wraps(test_func)
View
3 tests/regressiontests/settings_tests/tests.py
@@ -18,6 +18,9 @@ def test_method_override(self):
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')

0 comments on commit 2b4341d

Please sign in to comment.