It would be useful to be able to write code like this:
with override_flag(MY_FLAG=True):
# do some code that checks the value of MY_FLAG
The tests tend to use Django override_settings for this purpose, but this feels too heavy for inline code that only needs to patch a single flag instead of modifying the entire settings structure (not to mention adding a dependency on "test" code).
I realize this might be complicated because of the way that flag states get cached on the request object, but I suspect that using override_settings wouldn't work there either if the flag states were already cached.
It would be useful to be able to write code like this:
The tests tend to use Django
override_settings
for this purpose, but this feels too heavy for inline code that only needs to patch a single flag instead of modifying the entire settings structure (not to mention adding a dependency on "test" code).I realize this might be complicated because of the way that flag states get cached on the request object, but I suspect that using
override_settings
wouldn't work there either if the flag states were already cached.