1
0
mirror of https://github.com/django/django.git synced 2024-12-24 18:16:19 +00:00

Fixed #20032 -- Documented how to simulate the absence of a setting

Thanks Ram Rachum for the report.
This commit is contained in:
Claude Paroz 2013-03-13 23:11:35 +01:00
parent e4d9f8aed1
commit 50eb70b08f

View File

@ -1415,6 +1415,14 @@ The decorator can also be applied to test case classes::
the original ``LoginTestCase`` is still equally affected by the the original ``LoginTestCase`` is still equally affected by the
decorator. decorator.
You can also simulate the absence of a setting by deleting it after settings
have been overriden, like this::
@override_settings()
def test_something(self):
del settings.LOGIN_URL
...
When overriding settings, make sure to handle the cases in which your app's When overriding settings, make sure to handle the cases in which your app's
code uses a cache or similar feature that retains state even if the code uses a cache or similar feature that retains state even if the
setting is changed. Django provides the setting is changed. Django provides the