test: use db.before_commit

This commit is contained in:
Ankush Menat 2023-06-02 21:30:56 +05:30 committed by Ankush Menat
parent 6519651002
commit ccc107b41f
2 changed files with 1 additions and 2 deletions

View file

@ -976,7 +976,6 @@ class Database:
def commit(self):
"""Commit current transaction. Calls SQL `COMMIT`."""
# Invalidated by a commit.
self.before_rollback.reset()
self.after_rollback.reset()

View file

@ -32,7 +32,7 @@ class FrappeTestCase(unittest.TestCase):
# flush changes done so far to avoid flake
frappe.db.commit()
if cls.SHOW_TRANSACTION_COMMIT_WARNINGS:
frappe.db.add_before_commit(_commit_watcher)
frappe.db.before_commit.add(_commit_watcher)
# enqueue teardown actions (executed in LIFO order)
cls.addClassCleanup(_restore_thread_locals, copy.deepcopy(frappe.local.flags))