Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testing app context #18

Merged
merged 6 commits into from
Mar 2, 2023
Merged

Testing app context #18

merged 6 commits into from
Mar 2, 2023

Conversation

guruofgentoo
Copy link
Member

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 because flask.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.

@guruofgentoo guruofgentoo merged commit 59d7d01 into master Mar 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant