refactor: replace IntegrationTestCase with ERPNextTestCase repo-wide

- import ERPNextTestSuite
 - use it on test class
This commit is contained in:
ruthra kumar
2026-01-20 10:12:06 +05:30
parent 0fdc961a4b
commit f1dfac417d
319 changed files with 870 additions and 867 deletions

View File

@@ -2,10 +2,11 @@
# See license.txt
import frappe
from frappe.tests import IntegrationTestCase
from erpnext.tests.utils import ERPNextTestSuite
class TestSubcontractingBOM(IntegrationTestCase):
class TestSubcontractingBOM(ERPNextTestSuite):
pass

View File

@@ -2,13 +2,6 @@
# See license.txt
import frappe
from frappe.tests import IntegrationTestCase
# On IntegrationTestCase, the doctype test records and all
# link-field test record dependencies are recursively loaded
# Use these module variables to add/remove to/from that list
EXTRA_TEST_RECORD_DEPENDENCIES = [] # eg. ["User"]
IGNORE_TEST_RECORD_DEPENDENCIES = [] # eg. ["User"]
from erpnext.manufacturing.doctype.work_order.work_order import make_stock_entry as make_stock_entry_from_wo
from erpnext.selling.doctype.sales_order.sales_order import make_subcontracting_inward_order
@@ -16,9 +9,10 @@ from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_orde
from erpnext.stock.doctype.item.test_item import make_item
from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry
from erpnext.stock.doctype.warehouse.test_warehouse import create_warehouse
from erpnext.tests.utils import ERPNextTestSuite
class IntegrationTestSubcontractingInwardOrder(IntegrationTestCase):
class IntegrationTestSubcontractingInwardOrder(ERPNextTestSuite):
"""
Integration tests for SubcontractingInwardOrder.
Use this class for testing interactions between multiple components.
@@ -295,8 +289,8 @@ class IntegrationTestSubcontractingInwardOrder(IntegrationTestCase):
self.assertEqual(scio.items[0].delivered_qty, 2)
self.assertEqual(scio.items[0].returned_qty, 1)
@IntegrationTestCase.change_settings("Selling Settings", {"allow_delivery_of_overproduced_qty": 1})
@IntegrationTestCase.change_settings(
@ERPNextTestSuite.change_settings("Selling Settings", {"allow_delivery_of_overproduced_qty": 1})
@ERPNextTestSuite.change_settings(
"Manufacturing Settings", {"overproduction_percentage_for_work_order": 20}
)
def test_over_production_delivery(self):
@@ -329,8 +323,8 @@ class IntegrationTestSubcontractingInwardOrder(IntegrationTestCase):
delivery.items[0].qty = 6
self.assertRaises(frappe.ValidationError, delivery.submit)
@IntegrationTestCase.change_settings("Selling Settings", {"deliver_scrap_items": 1})
def test_scrap_delivery(self):
@ERPNextTestSuite.change_settings("Selling Settings", {"deliver_scrap_items": 1})
def test_secondary_items_delivery(self):
new_bom = frappe.copy_doc(frappe.get_doc("BOM", "BOM-Basic FG Item-001"))
new_bom.scrap_items.append(frappe.new_doc("BOM Scrap Item", item_code="Basic RM 2", qty=1))
new_bom.submit()

View File

@@ -5,7 +5,6 @@ import copy
from collections import defaultdict
import frappe
from frappe.tests import IntegrationTestCase
from frappe.utils import flt
from erpnext.buying.doctype.purchase_order.purchase_order import get_mapped_subcontracting_order
@@ -31,9 +30,10 @@ from erpnext.stock.doctype.stock_entry.test_stock_entry import make_stock_entry
from erpnext.subcontracting.doctype.subcontracting_order.subcontracting_order import (
make_subcontracting_receipt,
)
from erpnext.tests.utils import ERPNextTestSuite
class TestSubcontractingOrder(IntegrationTestCase):
class TestSubcontractingOrder(ERPNextTestSuite):
def setUp(self):
make_subcontracted_items()
make_raw_materials()

View File

@@ -5,7 +5,6 @@
import copy
import frappe
from frappe.tests import IntegrationTestCase
from frappe.utils import add_days, cint, flt, nowtime, today
import erpnext
@@ -41,9 +40,10 @@ from erpnext.subcontracting.doctype.subcontracting_order.subcontracting_order im
from erpnext.subcontracting.doctype.subcontracting_receipt.subcontracting_receipt import (
BOMQuantityError,
)
from erpnext.tests.utils import ERPNextTestSuite
class TestSubcontractingReceipt(IntegrationTestCase):
class TestSubcontractingReceipt(ERPNextTestSuite):
def setUp(self):
make_subcontracted_items()
make_raw_materials()
@@ -497,7 +497,7 @@ class TestSubcontractingReceipt(IntegrationTestCase):
self.assertEqual(expected_values[gle.account][0], gle.debit)
self.assertEqual(expected_values[gle.account][1], gle.credit)
@IntegrationTestCase.change_settings("Stock Settings", {"use_serial_batch_fields": 0})
@ERPNextTestSuite.change_settings("Stock Settings", {"use_serial_batch_fields": 0})
def test_subcontracting_receipt_with_zero_service_cost(self):
warehouse = "Stores - TCP1"
service_items = [
@@ -1439,7 +1439,7 @@ class TestSubcontractingReceipt(IntegrationTestCase):
sr.reload()
self.assertEqual(sr.items[0].rejected_qty, 2) # Should remain the same
@IntegrationTestCase.change_settings("Buying Settings", {"auto_create_purchase_receipt": 1})
@ERPNextTestSuite.change_settings("Buying Settings", {"auto_create_purchase_receipt": 1})
def test_auto_create_purchase_receipt(self):
from erpnext.buying.doctype.purchase_order.test_purchase_order import create_purchase_order
@@ -1503,7 +1503,7 @@ class TestSubcontractingReceipt(IntegrationTestCase):
self.assertEqual(pr_details[0]["total_taxes_and_charges"], 60)
@IntegrationTestCase.change_settings("Buying Settings", {"auto_create_purchase_receipt": 1})
@ERPNextTestSuite.change_settings("Buying Settings", {"auto_create_purchase_receipt": 1})
def test_auto_create_purchase_receipt_with_no_reference_of_po_item(self):
from erpnext.buying.doctype.purchase_order.test_purchase_order import create_purchase_order
@@ -2001,8 +2001,8 @@ class TestSubcontractingReceipt(IntegrationTestCase):
self.assertRaises(BOMQuantityError, scr.submit)
@IntegrationTestCase.change_settings("Buying Settings", {"over_transfer_allowance": 20})
@IntegrationTestCase.change_settings("Stock Settings", {"over_delivery_receipt_allowance": 20})
@ERPNextTestSuite.change_settings("Buying Settings", {"over_transfer_allowance": 20})
@ERPNextTestSuite.change_settings("Stock Settings", {"over_delivery_receipt_allowance": 20})
def test_over_receipt(self):
from erpnext.controllers.subcontracting_controller import make_rm_stock_entry