Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Provide a config value to enable pushing a fresh app context on each request.
Some flask extensions use
flask.g
to globally cache data relevant to the request cycle. They can do this becauseflask.g
is scoped to the app context, and flask pushes both an app and request context on the stack for each request. Currently, unless some cleanup is performed or special attention is given to pushing an app context on each use of a flask-webtest client, this lack of context handling causes breakage in things like CSRF protection or flask-login user caching.Enabling the config value will cause each request to happen in its own app context. I have left the default disabled to preserve backwards compatibility for now.