diff --git a/frappe/database/database.py b/frappe/database/database.py index 44876602b7..816d91062c 100644 --- a/frappe/database/database.py +++ b/frappe/database/database.py @@ -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() diff --git a/frappe/tests/utils.py b/frappe/tests/utils.py index df02ee2789..33b2a6c478 100644 --- a/frappe/tests/utils.py +++ b/frappe/tests/utils.py @@ -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))