From ccc107b41fbd0edac3318d77d45976a474aeb207 Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Fri, 2 Jun 2023 21:30:56 +0530 Subject: [PATCH] test: use db.before_commit --- frappe/database/database.py | 1 - frappe/tests/utils.py | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) 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))