fix(testing): ensure idempotency on the test environment user

This commit is contained in:
David 2024-11-13 10:40:09 +01:00
parent 504ef2e9e4
commit e2f5536f08
No known key found for this signature in database
GPG key ID: AB15A6AF1101390D
2 changed files with 4 additions and 1 deletions

View file

@ -85,7 +85,6 @@ class ParallelTestRunner:
print("running tests from", "/".join(file_info))
return
frappe.set_user("Administrator")
path, filename = file_info
module = self.get_module(path, filename)
test_suite = unittest.TestSuite()

View file

@ -49,6 +49,10 @@ class UnitTestCase(unittest.TestCase, BaseTestCase):
super().setUpClass()
cls.doctype = _get_doctype_from_module(cls)
cls.module = frappe.get_module(cls.__module__)
# Test Environment
frappe.set_user("Administrator")
# Test Environment (cleanup)
cls.addClassCleanup(frappe.set_user, "Administrator")
cls._unit_test_case_class_setup_done = True
def assertQueryEqual(self, first: str, second: str) -> None: