Skip to content

modify_settings

A context manager to support patching application settings.

modify_settings

modify_settings(*update)

Context manager that modify the desired settings and restore them on exit.

assert settings.app.ENVIRONMENT = "local" with modify_settings((settings.app, {"ENVIRONMENT": "prod"})): assert settings.app.ENVIRONMENT == "prod" assert settings.app.ENVIRONMENT == "local"