diff options
| author | Ramiro Morales <cramm0@gmail.com> | 2011-09-04 22:51:53 +0000 |
|---|---|---|
| committer | Ramiro Morales <cramm0@gmail.com> | 2011-09-04 22:51:53 +0000 |
| commit | 2b4341d532b376702a17212a9ff9f8710ca4c14a (patch) | |
| tree | 4fbe65d35668764344d095d73fd546417ebc326d | |
| parent | efd682e436d5ea6de5fe0a6d09fee70dd6fc3c50 (diff) | |
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].
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16722 bcc190cf-cafb-0310-a4f2-bffc1f526a37
| -rw-r--r-- | django/test/utils.py | 1 | ||||
| -rw-r--r-- | tests/regressiontests/settings_tests/tests.py | 3 |
2 files changed, 4 insertions, 0 deletions
diff --git a/django/test/utils.py b/django/test/utils.py index 9673a26b98..0ca7a1a25d 100644 --- a/django/test/utils.py +++ b/django/test/utils.py @@ -211,6 +211,7 @@ class override_settings(object): { '_pre_setup': _pre_setup, '_post_teardown': _post_teardown, + '__module__': test_func.__module__, }) else: @wraps(test_func) diff --git a/tests/regressiontests/settings_tests/tests.py b/tests/regressiontests/settings_tests/tests.py index 6af2ed307b..3f76368cea 100644 --- a/tests/regressiontests/settings_tests/tests.py +++ b/tests/regressiontests/settings_tests/tests.py @@ -18,6 +18,9 @@ class FullyDecoratedTranTestCase(TransactionTestCase): 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') |
