Skip to content

Commit

Permalink
Use join_transaction_mode='create_savepoint' (#15826)
Browse files Browse the repository at this point in the history
  • Loading branch information
di committed Apr 22, 2024
1 parent 97d8de8 commit 33a247c
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,16 +345,7 @@ def db_session(app_config):
engine = app_config.registry["sqlalchemy.engine"]
conn = engine.connect()
trans = conn.begin()
session = Session(bind=conn)

# Start the session in a SAVEPOINT
session.begin_nested()

# Then each time that SAVEPOINT ends, reopen it
@event.listens_for(session, "after_transaction_end")
def restart_savepoint(session, transaction):
if transaction.nested and not transaction._parent.nested:
session.begin_nested()
session = Session(bind=conn, join_transaction_mode="create_savepoint")

try:
yield session
Expand Down

0 comments on commit 33a247c

Please sign in to comment.