#20636: AttributeError: 'Settings' object has no attribute
'_original_allowed_hosts'
---------------------------------------------+------------------------
               Reporter:  aaugustin          |          Owner:  nobody
                   Type:  Bug                |         Status:  new
              Component:  Testing framework  |        Version:  master
               Severity:  Release blocker    |       Keywords:
           Triage Stage:  Unreviewed         |      Has patch:  0
    Needs documentation:  0                  |    Needs tests:  0
Patch needs improvement:  0                  |  Easy pickings:  0
                  UI/UX:  0                  |
---------------------------------------------+------------------------
 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.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/20636>
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/052.064fe3e0c0cefd214a15dd186b438e22%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to