Skip to content

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

@repole

Description

@repole

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions