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

Prevent a Session from being closed multiple times #660

Open
wants to merge 4 commits into
base: orm-migrations
Choose a base branch
from

Conversation

Zahlii
Copy link

@Zahlii Zahlii commented Aug 8, 2022

Currently, the Flask API does not work correctly with the Flask.test_client() method when used multiple times.

The reason for that is that due to the teardown hook added in pony/flask/init.py gets called after each time the test_client gets exited. However, the db_session got closed before already after the request, leading to two calls to session.exit(). This in turn will force the local context counter to go negative, so that the next call will fail with assert not context_counter...

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

2 participants