override_settings
as a context managerTo override settings in tests django provides override_settings
. In the docs it is only shown as a decorator, but the function can also be used as a context manager.
with override_settings(SOME_SETTING=true):
...