From bb561ba7a8f6410f34409ba5f5d7a95653a7d1e4 Mon Sep 17 00:00:00 2001 From: marination Date: Mon, 15 Nov 2021 15:21:20 +0530 Subject: [PATCH] fix: Server side test - make `tests_that_skip_setup` a tuple (added comma) - remove manual teardown in `test_job_card_material_transfer_correctness` to avoid premature committing - transfer_material_against = "Job Card" while making BOM with mulitple operations --- .../manufacturing/doctype/job_card/test_job_card.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/erpnext/manufacturing/doctype/job_card/test_job_card.py b/erpnext/manufacturing/doctype/job_card/test_job_card.py index e16c4802fe4e..51df35beabb3 100644 --- a/erpnext/manufacturing/doctype/job_card/test_job_card.py +++ b/erpnext/manufacturing/doctype/job_card/test_job_card.py @@ -20,7 +20,7 @@ def setUp(self): transfer_material_against, source_warehouse = None, None tests_that_skip_setup = ( - "test_job_card_material_transfer_correctness" + "test_job_card_material_transfer_correctness", ) tests_that_transfer_against_jc = ( "test_job_card_multiple_materials_transfer", @@ -272,14 +272,10 @@ def test_job_card_material_transfer_correctness(self): self.assertEqual(transfer_entry.items[0].item_code, "_Test Item") self.assertEqual(transfer_entry.items[0].qty, 2) - # teardown - transfer_entry.delete() - frappe.db.delete("Job Card", {"work_order": work_order.name}) - work_order.cancel() - bom.cancel() - + # rollback via tearDown method def create_bom_with_multiple_operations(): + "Create a BOM with multiple operations and Material Transfer against Job Card" from erpnext.manufacturing.doctype.operation.test_operation import make_operation test_record = frappe.get_test_records("BOM")[2] @@ -303,6 +299,7 @@ def create_bom_with_multiple_operations(): "operating_cost": 100 }) + bom_doc.transfer_material_against = "Job Card" bom_doc.save() bom_doc.submit()