refactor: replace all IntegrationTestCase -> ERPNextTestSuite

This commit is contained in:
ruthra kumar
2025-07-16 13:29:02 +05:30
parent 4cdf5f542e
commit 29cf028f9a
7 changed files with 11 additions and 30 deletions

View File

@@ -1,17 +1,10 @@
# Copyright (c) 2025, Frappe Technologies Pvt. Ltd. and Contributors # Copyright (c) 2025, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt # See license.txt
# import frappe from erpnext.tests.utils import ERPNextTestSuite
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"]
class IntegrationTestTaxWithholdingEntry(IntegrationTestCase): class IntegrationTestTaxWithholdingEntry(ERPNextTestSuite):
""" """
Integration tests for TaxWithholdingEntry. Integration tests for TaxWithholdingEntry.
Use this class for testing interactions between multiple components. Use this class for testing interactions between multiple components.

View File

@@ -1,17 +1,10 @@
# Copyright (c) 2025, Frappe Technologies Pvt. Ltd. and Contributors # Copyright (c) 2025, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt # See license.txt
# import frappe from erpnext.tests.utils import ERPNextTestSuite
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"]
class IntegrationTestTaxWithholdingGroup(IntegrationTestCase): class IntegrationTestTaxWithholdingGroup(ERPNextTestSuite):
""" """
Integration tests for TaxWithholdingGroup. Integration tests for TaxWithholdingGroup.
Use this class for testing interactions between multiple components. Use this class for testing interactions between multiple components.

View File

@@ -3,18 +3,18 @@
import frappe import frappe
from frappe import _ from frappe import _
from frappe.tests import IntegrationTestCase
from frappe.utils import flt, today from frappe.utils import flt, today
from erpnext.accounts.report.consolidated_trial_balance.consolidated_trial_balance import execute from erpnext.accounts.report.consolidated_trial_balance.consolidated_trial_balance import execute
from erpnext.setup.utils import get_exchange_rate from erpnext.setup.utils import get_exchange_rate
from erpnext.tests.utils import ERPNextTestSuite
class ForeignCurrencyTranslationReserveNotFoundError(frappe.ValidationError): class ForeignCurrencyTranslationReserveNotFoundError(frappe.ValidationError):
pass pass
class TestConsolidatedTrialBalance(IntegrationTestCase): class TestConsolidatedTrialBalance(ERPNextTestSuite):
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
from erpnext.accounts.report.trial_balance.test_trial_balance import create_company from erpnext.accounts.report.trial_balance.test_trial_balance import create_company

View File

@@ -5,7 +5,6 @@ import unittest
import frappe import frappe
from frappe import qb from frappe import qb
from frappe.query_builder.functions import Sum from frappe.query_builder.functions import Sum
from frappe.tests import IntegrationTestCase
from frappe.utils import add_days, add_months, flt, get_first_day, nowdate, nowtime, today from frappe.utils import add_days, add_months, flt, get_first_day, nowdate, nowtime, today
from erpnext.assets.doctype.asset.asset import ( from erpnext.assets.doctype.asset.asset import (

View File

@@ -5,8 +5,7 @@ import copy
from collections import defaultdict from collections import defaultdict
import frappe import frappe
from frappe.tests import IntegrationTestCase from frappe.utils import add_days, today
from frappe.utils import add_days, cint, today
from erpnext.manufacturing.doctype.production_plan.test_production_plan import make_bom from erpnext.manufacturing.doctype.production_plan.test_production_plan import make_bom
from erpnext.manufacturing.doctype.work_order.test_work_order import make_wo_order_test_record from erpnext.manufacturing.doctype.work_order.test_work_order import make_wo_order_test_record
@@ -14,9 +13,10 @@ from erpnext.manufacturing.doctype.work_order.work_order import make_stock_entry
from erpnext.stock.doctype.delivery_note.test_delivery_note import create_delivery_note from erpnext.stock.doctype.delivery_note.test_delivery_note import create_delivery_note
from erpnext.stock.doctype.item.test_item import make_item from erpnext.stock.doctype.item.test_item import make_item
from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import make_purchase_receipt from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import make_purchase_receipt
from erpnext.tests.utils import ERPNextTestSuite
class TestItemWiseInventoryAccount(IntegrationTestCase): class TestItemWiseInventoryAccount(ERPNextTestSuite):
def setUp(self): def setUp(self):
self.company = make_company() self.company = make_company()
self.company_abbr = frappe.db.get_value("Company", self.company, "abbr") self.company_abbr = frappe.db.get_value("Company", self.company, "abbr")

View File

@@ -1021,7 +1021,7 @@ class TestQuotation(ERPNextTestSuite):
quotation.reload() quotation.reload()
self.assertEqual(quotation.status, "Ordered") self.assertEqual(quotation.status, "Ordered")
@change_settings("Accounts Settings", {"allow_pegged_currencies_exchange_rates": True}) @ERPNextTestSuite.change_settings("Accounts Settings", {"allow_pegged_currencies_exchange_rates": True})
def test_make_quotation_qar_to_inr(self): def test_make_quotation_qar_to_inr(self):
quotation = make_quotation( quotation = make_quotation(
currency="QAR", currency="QAR",

View File

@@ -2369,10 +2369,8 @@ class TestStockEntry(ERPNextTestSuite):
self.assertEqual(target_sabb.entries[0].batch_no, batch) self.assertEqual(target_sabb.entries[0].batch_no, batch)
self.assertEqual([entry.serial_no for entry in target_sabb.entries], serial_nos[:2]) self.assertEqual([entry.serial_no for entry in target_sabb.entries], serial_nos[:2])
@ERPNextTestSuite.change_settings("Manufacturing Settings", {"material_consumption": 0})
def test_raw_material_missing_validation(self): def test_raw_material_missing_validation(self):
original_value = frappe.db.get_single_value("Manufacturing Settings", "material_consumption")
frappe.db.set_single_value("Manufacturing Settings", "material_consumption", 0)
stock_entry = make_stock_entry( stock_entry = make_stock_entry(
item_code="_Test Item", item_code="_Test Item",
qty=1, qty=1,
@@ -2389,8 +2387,6 @@ class TestStockEntry(ERPNextTestSuite):
stock_entry.save, stock_entry.save,
) )
frappe.db.set_single_value("Manufacturing Settings", "material_consumption", original_value)
@ERPNextTestSuite.change_settings( @ERPNextTestSuite.change_settings(
"Manufacturing Settings", "Manufacturing Settings",
{ {