diff --git a/erpnext/buying/doctype/supplier/test_supplier.py b/erpnext/buying/doctype/supplier/test_supplier.py index 719770a6853..e0a2a379ed8 100644 --- a/erpnext/buying/doctype/supplier/test_supplier.py +++ b/erpnext/buying/doctype/supplier/test_supplier.py @@ -204,8 +204,8 @@ class TestSupplierPortal(FrappeTestCase): supplier.append("portal_users", {"user": user}) supplier.save() - frappe.set_user(user) - _, suppliers = get_customers_suppliers("Purchase Order", user) + with self.set_user(user): + _, suppliers = get_customers_suppliers("Purchase Order", user) self.assertIn(supplier.name, suppliers) diff --git a/erpnext/selling/doctype/customer/test_customer.py b/erpnext/selling/doctype/customer/test_customer.py index bfd66d51d24..e6ed7acb508 100644 --- a/erpnext/selling/doctype/customer/test_customer.py +++ b/erpnext/selling/doctype/customer/test_customer.py @@ -29,7 +29,8 @@ class TestCustomer(FrappeTestCase): make_test_records("Item") def tearDown(self): - set_credit_limit("_Test Customer", "_Test Company", 0) + if frappe.db.exists("Customer", "_Test Customer"): + set_credit_limit("_Test Customer", "_Test Company", 0) def test_get_customer_group_details(self): doc = frappe.new_doc("Customer Group")