Hi Daniel!
Prior to Django 1.6 (552a90b444) override_settings couldn't be safely nested.
Could you try running your example against this version and report back here?
I guess a 1.6 release note addition and a 1.5 warning wouldn't hurt here. Maybe you could open a ticket suggesting those two documentation addition?
Simon
Le dimanche 17 novembre 2013 23:04:51 UTC-5, Daniel Smith a écrit :
-- Prior to Django 1.6 (552a90b444) override_settings couldn't be safely nested.
Could you try running your example against this version and report back here?
I guess a 1.6 release note addition and a 1.5 warning wouldn't hurt here. Maybe you could open a ticket suggesting those two documentation addition?
Simon
Le dimanche 17 novembre 2013 23:04:51 UTC-5, Daniel Smith a écrit :
I recently ran into a bug in our test code due to override settings resetting the settings to default after the function returned. Obviously, we shouldn't be using the override_settings decorator on a random function, but I think there is still room for improvement. At minimum, I think it would help to provide more detail in the documentation to warn against this use case.Here's an example demonstrating the problem, we're running Django 1.5.1 with Python 2.7:settings.pySETTING_A = Truefoo_test.py@override_settings(SETTING_B=False) def foo_test_func()print settings.SETTING_A@override_settings(SETTING_A=False) class FooTest(TestCase):def test_foo(self):foo_test_func()foo_test_func()The above code prints out False then True.It seems to me that foo_test_func() should be resetting the settings to the settings it originally encountered, but that was not the effect that I saw.Best,Daniel
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/38bedece-0efb-4719-9d4e-74de69864821%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment