Opened 9 years ago
Closed 9 years ago
#26427 closed Bug (fixed)
AttributeError for a deleted setting under @override_settings, when an Exception is raised
Reported by: | master | Owned by: | nobody |
---|---|---|---|
Component: | Testing framework | Version: | 1.9 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
@override_settings() class DemoTest(TestCase): def test(self): del settings.SOME # is in settings.py url = reverse('viewname_with_a_non_existant_template') self.assertRaises(TemplateDoesNotExist, self.client.get, url)
Output:
... File "D:\Python34\lib\site-packages\django-1.9.4-py3.4.egg\django\views\debug.py", line 294, in get_traceback_data 'settings': get_safe_settings(), File "D:\Python34\lib\site-packages\django-1.9.4-py3.4.egg\django\views\debug.py", line 70, in get_safe_settings settings_dict[k] = cleanse_setting(k, getattr(settings, k)) File "D:\Python34\lib\site-packages\django-1.9.4-py3.4.egg\django\conf\__init__.py", line 56, in __getattr__ return getattr(self._wrapped, name) File "D:\Python34\lib\site-packages\django-1.9.4-py3.4.egg\django\conf\__init__.py", line 172, in __getattr__ raise AttributeError
SOME is registered in self._deleted
, but also returned by __dir__()
from dir(self.default_settings)
,
and so collected in get_safe_settings()
.
Note: this is a blocking issue for me in the replacement of the deprecated SimpleTestCase.urls
by override_settings(ROOT_URLCONF=...)
.
Change History (3)
comment:1 by , 9 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:2 by , 9 years ago
Has patch: | set |
---|---|
Triage Stage: | Accepted → Ready for checkin |
Note:
See TracTickets
for help on using tickets.
PR