jeancochrane / jeancochrane/pytest-flask-sqlalchemy

[question] Why is session.bind set to engine? Excessive savepoints?

Open
#45 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
253
Forks
45
PR merge metrics
No merged PRs in 30d

Description

I'm primarily using the db_session fixture, and I've noticed that my tests are creating savepoints at seemingly every database interaction. Trying to narrow things down, I noticed that commenting out this line seems to remove all but the outermost savepoint.

https://github.com/jeancochrane/pytest-flask-sqlalchemy/blob/master/pytest_flask_sqlalchemy/fixtures.py#L150

Trying to understand all of the logic here to make sure any tinkering I'm doing doesn't mess up any fundamental things here. What is the reasoning for setting `session.bind = engine` here, when it's already been previously bound to a nested transaction?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.