Rollback existing nested transacvtion before restarting
SQLAlchemy 1.4 will be adding stricter rules to Connection objects such that a new transaction cannot be started while an old one hasn't been cleared. Ensure this particular test fixture clears the "savepoint" transaction first before starting a new one. References: https://github.com/sqlalchemy/sqlalchemy/issues/4712 Change-Id: Idcb616fd3add4d58f22b91865cec8a54fe492093
This commit is contained in:
parent
2f8250f3f7
commit
459de14357
@ -1227,12 +1227,16 @@ class NonCommittingConnectable(object):
|
||||
|
||||
"""
|
||||
|
||||
_nested_trans = None
|
||||
|
||||
def __init__(self, connection):
|
||||
self.connection = connection
|
||||
self._trans = connection.begin()
|
||||
self._restart_nested()
|
||||
|
||||
def _restart_nested(self):
|
||||
if self._nested_trans is not None:
|
||||
self._nested_trans.rollback()
|
||||
self._nested_trans = self.connection.begin_nested()
|
||||
|
||||
def _dispose(self):
|
||||
|
Loading…
Reference in New Issue
Block a user