jeancochrane / pytest-flask-sqlalchemy

A pytest plugin for preserving test isolation in Flask-SQLAlchemy using database transactions.
MIT License
255 stars 45 forks source link

expunge instances before restarting nested transaction #40

Closed c0state closed 3 years ago

c0state commented 4 years ago

Should this call expunge_all instead of expire_all?

I'm seeing some test failures with stale instances that hit https://github.com/sqlalchemy/sqlalchemy/blob/rel_1_3_19/lib/sqlalchemy/orm/session.py#L2603 if only expire_all is called.

At this point, uncommitted instances can be disregarded I believe?

c0state commented 3 years ago

@jeancochrane any thoughts on this and #41 ?

jeancochrane commented 3 years ago

Sorry for the extra late reply here @c0state, do you have a sample test I can use to verify the problem?