mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-02 19:59:12 +00:00
fix(testing): setup class must invoke super
This commit is contained in:
@@ -18,6 +18,7 @@ from erpnext.tests.utils import if_lending_app_installed, if_lending_app_not_ins
|
|||||||
class TestBankClearance(IntegrationTestCase):
|
class TestBankClearance(IntegrationTestCase):
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
|
super().setUpClass()
|
||||||
create_warehouse(
|
create_warehouse(
|
||||||
warehouse_name="_Test Warehouse",
|
warehouse_name="_Test Warehouse",
|
||||||
properties={"parent_warehouse": "All Warehouses - _TC"},
|
properties={"parent_warehouse": "All Warehouses - _TC"},
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sal
|
|||||||
class TestLoyaltyPointEntry(IntegrationTestCase):
|
class TestLoyaltyPointEntry(IntegrationTestCase):
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
|
super().setUpClass()
|
||||||
# Create test records
|
# Create test records
|
||||||
create_records()
|
create_records()
|
||||||
cls.loyalty_program_name = "Test Single Loyalty"
|
cls.loyalty_program_name = "Test Single Loyalty"
|
||||||
|
|||||||
@@ -15,7 +15,8 @@ from erpnext.accounts.party import get_dashboard_info
|
|||||||
|
|
||||||
class TestLoyaltyProgram(IntegrationTestCase):
|
class TestLoyaltyProgram(IntegrationTestCase):
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(self):
|
def setUpClass(cls):
|
||||||
|
super().setUpClass()
|
||||||
# create relevant item, customer, loyalty program, etc
|
# create relevant item, customer, loyalty program, etc
|
||||||
create_records()
|
create_records()
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ class UnitTestOpeningInvoiceCreationTool(UnitTestCase):
|
|||||||
|
|
||||||
class TestOpeningInvoiceCreationTool(IntegrationTestCase):
|
class TestOpeningInvoiceCreationTool(IntegrationTestCase):
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(self):
|
def setUpClass(cls):
|
||||||
if not frappe.db.exists("Company", "_Test Opening Invoice Company"):
|
if not frappe.db.exists("Company", "_Test Opening Invoice Company"):
|
||||||
make_company()
|
make_company()
|
||||||
create_dimension()
|
create_dimension()
|
||||||
|
|||||||
@@ -44,13 +44,13 @@ IGNORE_TEST_RECORD_DEPENDENCIES = ["Serial No"]
|
|||||||
|
|
||||||
class TestPurchaseInvoice(IntegrationTestCase, StockTestMixin):
|
class TestPurchaseInvoice(IntegrationTestCase, StockTestMixin):
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(self):
|
def setUpClass(cls):
|
||||||
super().setUpClass()
|
super().setUpClass()
|
||||||
unlink_payment_on_cancel_of_invoice()
|
unlink_payment_on_cancel_of_invoice()
|
||||||
frappe.db.set_single_value("Buying Settings", "allow_multiple_items", 1)
|
frappe.db.set_single_value("Buying Settings", "allow_multiple_items", 1)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def tearDownClass(self):
|
def tearDownClass(cls):
|
||||||
unlink_payment_on_cancel_of_invoice(0)
|
unlink_payment_on_cancel_of_invoice(0)
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ from erpnext.crm.doctype.opportunity.test_opportunity import make_opportunity
|
|||||||
class TestTaxRule(IntegrationTestCase):
|
class TestTaxRule(IntegrationTestCase):
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
|
super().setUpClass()
|
||||||
frappe.db.set_single_value("Shopping Cart Settings", "enabled", 0)
|
frappe.db.set_single_value("Shopping Cart Settings", "enabled", 0)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|||||||
@@ -27,7 +27,8 @@ class UnitTestTaxWithholdingCategory(UnitTestCase):
|
|||||||
|
|
||||||
class TestTaxWithholdingCategory(IntegrationTestCase):
|
class TestTaxWithholdingCategory(IntegrationTestCase):
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(self):
|
def setUpClass(cls):
|
||||||
|
super().setUpClass()
|
||||||
# create relevant supplier, etc
|
# create relevant supplier, etc
|
||||||
create_records()
|
create_records()
|
||||||
create_tax_withholding_category_records()
|
create_tax_withholding_category_records()
|
||||||
|
|||||||
@@ -14,9 +14,7 @@ from erpnext.accounts.utils import get_fiscal_year
|
|||||||
|
|
||||||
|
|
||||||
class TestDeferredRevenueAndExpense(IntegrationTestCase, AccountsTestMixin):
|
class TestDeferredRevenueAndExpense(IntegrationTestCase, AccountsTestMixin):
|
||||||
@classmethod
|
maxDiff = None
|
||||||
def setUpClass(self):
|
|
||||||
self.maxDiff = None
|
|
||||||
|
|
||||||
def clear_old_entries(self):
|
def clear_old_entries(self):
|
||||||
sinv = qb.DocType("Sales Invoice")
|
sinv = qb.DocType("Sales Invoice")
|
||||||
|
|||||||
@@ -17,7 +17,8 @@ EXTRA_TEST_RECORD_DEPENDENCIES = ["Sales Invoice"]
|
|||||||
|
|
||||||
class TestSalesPaymentSummary(IntegrationTestCase):
|
class TestSalesPaymentSummary(IntegrationTestCase):
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(self):
|
def setUpClass(cls):
|
||||||
|
super().setUpClass()
|
||||||
create_records()
|
create_records()
|
||||||
pes = frappe.get_all("Payment Entry")
|
pes = frappe.get_all("Payment Entry")
|
||||||
jes = frappe.get_all("Journal Entry")
|
jes = frappe.get_all("Journal Entry")
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import make_pu
|
|||||||
class AssetSetup(IntegrationTestCase):
|
class AssetSetup(IntegrationTestCase):
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
|
super().setUpClass()
|
||||||
set_depreciation_settings_in_company()
|
set_depreciation_settings_in_company()
|
||||||
create_asset_data()
|
create_asset_data()
|
||||||
enable_cwip_accounting("Computers")
|
enable_cwip_accounting("Computers")
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ class UnitTestAssetShiftAllocation(UnitTestCase):
|
|||||||
class TestAssetShiftAllocation(IntegrationTestCase):
|
class TestAssetShiftAllocation(IntegrationTestCase):
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
|
super().setUpClass()
|
||||||
create_asset_shift_factors()
|
create_asset_shift_factors()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|||||||
@@ -27,7 +27,9 @@ def create_test_appointment():
|
|||||||
|
|
||||||
|
|
||||||
class TestAppointment(IntegrationTestCase):
|
class TestAppointment(IntegrationTestCase):
|
||||||
def setUpClass():
|
@classmethod
|
||||||
|
def setUpClass(cls):
|
||||||
|
super().setUpClass()
|
||||||
frappe.db.delete("Lead", {"email_id": LEAD_EMAIL})
|
frappe.db.delete("Lead", {"email_id": LEAD_EMAIL})
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
|||||||
@@ -15,7 +15,8 @@ from erpnext.crm.report.sales_pipeline_analytics.test_sales_pipeline_analytics i
|
|||||||
|
|
||||||
class TestOpportunitySummaryBySalesStage(IntegrationTestCase):
|
class TestOpportunitySummaryBySalesStage(IntegrationTestCase):
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(self):
|
def setUpClass(cls):
|
||||||
|
super().setUpClass()
|
||||||
create_company()
|
create_company()
|
||||||
create_customer()
|
create_customer()
|
||||||
create_opportunity()
|
create_opportunity()
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ class UnitTestRouting(UnitTestCase):
|
|||||||
class TestRouting(IntegrationTestCase):
|
class TestRouting(IntegrationTestCase):
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
|
super().setUpClass()
|
||||||
cls.item_code = "Test Routing Item - A"
|
cls.item_code = "Test Routing Item - A"
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|||||||
@@ -16,17 +16,18 @@ months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct",
|
|||||||
|
|
||||||
class TestIssueAnalytics(IntegrationTestCase):
|
class TestIssueAnalytics(IntegrationTestCase):
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(self):
|
def setUpClass(cls):
|
||||||
|
super().setUpClass()
|
||||||
frappe.db.sql("delete from `tabIssue` where company='_Test Company'")
|
frappe.db.sql("delete from `tabIssue` where company='_Test Company'")
|
||||||
frappe.db.set_single_value("Support Settings", "track_service_level_agreement", 1)
|
frappe.db.set_single_value("Support Settings", "track_service_level_agreement", 1)
|
||||||
|
|
||||||
current_month_date = getdate()
|
current_month_date = getdate()
|
||||||
last_month_date = add_months(current_month_date, -1)
|
last_month_date = add_months(current_month_date, -1)
|
||||||
self.current_month = str(months[current_month_date.month - 1]).lower()
|
cls.current_month = str(months[current_month_date.month - 1]).lower()
|
||||||
self.last_month = str(months[last_month_date.month - 1]).lower()
|
cls.last_month = str(months[last_month_date.month - 1]).lower()
|
||||||
if current_month_date.year != last_month_date.year:
|
if current_month_date.year != last_month_date.year:
|
||||||
self.current_month += "_" + str(current_month_date.year)
|
cls.current_month += "_" + str(current_month_date.year)
|
||||||
self.last_month += "_" + str(last_month_date.year)
|
cls.last_month += "_" + str(last_month_date.year)
|
||||||
|
|
||||||
def test_issue_analytics(self):
|
def test_issue_analytics(self):
|
||||||
create_service_level_agreements_for_issues()
|
create_service_level_agreements_for_issues()
|
||||||
|
|||||||
@@ -12,14 +12,6 @@ from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry
|
|||||||
|
|
||||||
|
|
||||||
class TestPointOfSale(IntegrationTestCase):
|
class TestPointOfSale(IntegrationTestCase):
|
||||||
@classmethod
|
|
||||||
def setUpClass(cls) -> None:
|
|
||||||
frappe.db.savepoint("before_test_point_of_sale")
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def tearDownClass(cls) -> None:
|
|
||||||
frappe.db.rollback(save_point="before_test_point_of_sale")
|
|
||||||
|
|
||||||
def test_item_search(self):
|
def test_item_search(self):
|
||||||
"""
|
"""
|
||||||
Test Stock and Service Item Search.
|
Test Stock and Service Item Search.
|
||||||
|
|||||||
Reference in New Issue
Block a user