-
Notifications
You must be signed in to change notification settings - Fork 688
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
Flask Testing uses one request context per TestCase method #1444
Comments
I started writing a subclass of |
I made more progress on this over the weekend, but I totally screwed with my use of git and deleted that work in an unrecoverable manner 😭 |
Would just like to point out that this is biting me in the ass right now and we should fix it. :( |
Pointing out that this one got me again while writing tests for session expiration. |
Pointing out that this is still a problem 😐 😐 😐 |
In normal usage, each request object is processed in it's own request context. In Flask Testing all request objects are processed in a single request context for a given TestCase method. If you're only making a single request in a test method, everything will work as expected. However, if you want to test anything more complicated (i.e., anything that involves multiple users or multiple requests from a single users), all bets are off. To illustrate the problem, I've uploaded a Gist that illustrates the problem with a very simple example, and a little further explanation in the comments: https://gist.github.com/nvesely/b6e72ae0902c97723fcf44b46160d499.
Edit: link surgery.
The text was updated successfully, but these errors were encountered: