AttributeError: 'Settings' object has no attribute '_original_allowed_hosts'
|Reported by:||aaugustin||Owned by:||nobody|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
When running the tests for http://github.com/aaugustin/django-sesame against stable/1.5.x, I'm hitting this exception after they complete:
Traceback (most recent call last): File "/Users/myk/Documents/dev/django/django/core/management/base.py", line 222, in run_from_argv self.execute(*args, **options.__dict__) File "/Users/myk/Documents/dev/django/django/core/management/commands/test.py", line 72, in execute super(Command, self).execute(*args, **options) File "/Users/myk/Documents/dev/django/django/core/management/base.py", line 255, in execute output = self.handle(*args, **options) File "/Users/myk/Documents/dev/django/django/core/management/commands/test.py", line 89, in handle failures = test_runner.run_tests(test_labels) File "/Users/myk/Documents/dev/django/django/test/simple.py", line 370, in run_tests self.teardown_test_environment() File "/Users/myk/Documents/dev/django/django/test/simple.py", line 341, in teardown_test_environment teardown_test_environment() File "/Users/myk/Documents/dev/django/django/test/utils.py", line 104, in teardown_test_environment settings.ALLOWED_HOSTS = settings._original_allowed_hosts File "/Users/myk/Documents/dev/django/django/conf/__init__.py", line 54, in __getattr__ return getattr(self._wrapped, name) AttributeError: 'Settings' object has no attribute '_original_allowed_hosts'
I'm positive the tests used to work, and this application is only a few dozen lines of code and doesn't do anything really weird with settings.
It uses @override_settings, but I've tried to reproduce a similar pattern in Django's test suite and I didn't hit the bug:
from django.test.utils import override_settings @override_settings(MIDDLEWARE_CLASSES=('a',)) class Decorated(TestCase): def test_basic_math(self): self.assertEqual(2 + 2, 4) @override_settings(MIDDLEWARE_CLASSES=('b',)) class DoubleDecorated(TestCase): pass
I'm not sure why this happens, but since something that used to work now fails with a cryptic error, we should probably do something about it.
Change History (9)
comment:6 Changed 2 years ago by Aymeric Augustin <aymeric.augustin@…>
- Resolution set to fixed
- Status changed from new to closed