From 459f65ba189ef36e611dc175bb19a2efda35a9dd Mon Sep 17 00:00:00 2001 From: prssanna Date: Wed, 10 Mar 2021 16:17:59 +0530 Subject: [PATCH] test: explicitly start transaction before each test --- frappe/test_runner.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frappe/test_runner.py b/frappe/test_runner.py index e620b46e4a..0e81d69593 100644 --- a/frappe/test_runner.py +++ b/frappe/test_runner.py @@ -67,8 +67,6 @@ def main(app=None, module=None, doctype=None, verbose=False, tests=(), for fn in frappe.get_hooks("before_tests", app_name=app): frappe.get_attr(fn)() - frappe.db.begin() - if doctype: ret = run_tests_for_doctype(doctype, verbose, tests, force, profile, junit_xml_output=junit_xml_output) elif module: @@ -181,6 +179,8 @@ def run_tests_for_module(module, verbose=False, tests=(), profile=False, junit_x return _run_unittest(module, verbose=verbose, tests=tests, profile=profile, junit_xml_output=junit_xml_output) def _run_unittest(modules, verbose=False, tests=(), profile=False, junit_xml_output=False): + frappe.db.begin() + test_suite = unittest.TestSuite() if not isinstance(modules, (list, tuple)):