Replies: 1 comment 6 replies
-
Neither of the code blocks you've shown were correct before, they just happened to work by accident before. You do not need to override Do not push |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I’ve been using flask, flask-sqlalchemy together with pytest written unit tests for a while. With the upgrade to flask-sqlalchemy 3.0 and flask 2.2 I’m now unable to get my tests working because they fail with a “AssertionError: Popped wrong app context.” error that seems to be related to 84c722044.
I’ve been using the test-wide app context as described in the flask-sqlalchemy documentation
In order to separate the DB session for the test method from anything executed within a test request I’m also using a custom test client that wraps each test request into its own
app_context
.The “Popped wrong app context.” occurs when I issue two requests within the same test method:
I’ve added some debug output to flask/testing.py in order to see what’s happening and this is what I got:
At this point I’m not even sure why the test clients stack handling interferes with my app context.
Any suggestions?
Beta Was this translation helpful? Give feedback.
All reactions