Fix transaction over savepoint in initdb

This commit is contained in:
Joseph Schorr 2018-07-24 11:37:06 -04:00
parent 8e425ee559
commit 601ef416cb

View file

@ -208,8 +208,10 @@ def finished_database_for_testing(testcase):
""" Called when a testcase has finished using the database, indicating that
any changes should be discarded.
"""
testcases[testcase]['savepoint'].rollback()
testcases[testcase]['savepoint'].__exit__(True, None, None)
testcases[testcase]['atomic'].__exit__(True, None, None)
testcases[testcase]['transaction'].__exit__(True, None, None)
def setup_database_for_testing(testcase, with_storage=False, force_rebuild=False):
""" Called when a testcase has started using the database, indicating that
@ -243,8 +245,8 @@ def setup_database_for_testing(testcase, with_storage=False, force_rebuild=False
# Create a savepoint for the testcase.
testcases[testcase] = {}
testcases[testcase]['atomic'] = db.manual_commit()
testcases[testcase]['atomic'].__enter__()
testcases[testcase]['transaction'] = db.transaction()
testcases[testcase]['transaction'].__enter__()
testcases[testcase]['savepoint'] = db.savepoint()
testcases[testcase]['savepoint'].__enter__()