From 5d77f10baa3cb49ffb6dd812bcee67dbb0ddcfc6 Mon Sep 17 00:00:00 2001 From: Walstan Baptista <38958184+walstanb@users.noreply.github.com> Date: Sat, 3 Apr 2021 13:38:55 +0530 Subject: [PATCH] test: docs are not deleted in tearDown (#25123) * test: docs are not deleted in tearDown --- .../test_inpatient_medication_order.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/erpnext/healthcare/doctype/inpatient_medication_order/test_inpatient_medication_order.py b/erpnext/healthcare/doctype/inpatient_medication_order/test_inpatient_medication_order.py index a21caca8ff..21776d2380 100644 --- a/erpnext/healthcare/doctype/inpatient_medication_order/test_inpatient_medication_order.py +++ b/erpnext/healthcare/doctype/inpatient_medication_order/test_inpatient_medication_order.py @@ -81,15 +81,8 @@ class TestInpatientMedicationOrder(unittest.TestCase): self.ip_record.reload() discharge_patient(self.ip_record) - for entry in frappe.get_all('Inpatient Medication Entry'): - doc = frappe.get_doc('Inpatient Medication Entry', entry.name) - doc.cancel() - doc.delete() - - for entry in frappe.get_all('Inpatient Medication Order'): - doc = frappe.get_doc('Inpatient Medication Order', entry.name) - doc.cancel() - doc.delete() + for doctype in ["Inpatient Medication Entry", "Inpatient Medication Order"]: + frappe.db.sql("delete from `tab{doctype}`".format(doctype=doctype)) def create_dosage_form(): if not frappe.db.exists('Dosage Form', 'Tablet'):