#26427: AttributeError for a deleted setting under @override_settings, when an
Exception is raised
-----------------------------------+--------------------
     Reporter:  master             |      Owner:  nobody
         Type:  Bug                |     Status:  new
    Component:  Testing framework  |    Version:  1.9
     Severity:  Normal             |   Keywords:
 Triage Stage:  Unreviewed         |  Has patch:  0
Easy pickings:  0                  |      UI/UX:  0
-----------------------------------+--------------------
 {{{
 @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=...)}}}.

--
Ticket URL: <https://code.djangoproject.com/ticket/26427>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/049.c03a73001885e421f8e3146e54a60be1%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to