Merge pull request #43702 from blaggacao/tests/fix-setup-class-methods
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):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
super().setUpClass()
|
||||
create_warehouse(
|
||||
warehouse_name="_Test Warehouse",
|
||||
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):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
super().setUpClass()
|
||||
# Create test records
|
||||
create_records()
|
||||
cls.loyalty_program_name = "Test Single Loyalty"
|
||||
|
||||
@@ -15,7 +15,8 @@ from erpnext.accounts.party import get_dashboard_info
|
||||
|
||||
class TestLoyaltyProgram(IntegrationTestCase):
|
||||
@classmethod
|
||||
def setUpClass(self):
|
||||
def setUpClass(cls):
|
||||
super().setUpClass()
|
||||
# create relevant item, customer, loyalty program, etc
|
||||
create_records()
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ class UnitTestOpeningInvoiceCreationTool(UnitTestCase):
|
||||
|
||||
class TestOpeningInvoiceCreationTool(IntegrationTestCase):
|
||||
@classmethod
|
||||
def setUpClass(self):
|
||||
def setUpClass(cls):
|
||||
if not frappe.db.exists("Company", "_Test Opening Invoice Company"):
|
||||
make_company()
|
||||
create_dimension()
|
||||
|
||||
@@ -44,13 +44,13 @@ IGNORE_TEST_RECORD_DEPENDENCIES = ["Serial No"]
|
||||
|
||||
class TestPurchaseInvoice(IntegrationTestCase, StockTestMixin):
|
||||
@classmethod
|
||||
def setUpClass(self):
|
||||
def setUpClass(cls):
|
||||
super().setUpClass()
|
||||
unlink_payment_on_cancel_of_invoice()
|
||||
frappe.db.set_single_value("Buying Settings", "allow_multiple_items", 1)
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(self):
|
||||
def tearDownClass(cls):
|
||||
unlink_payment_on_cancel_of_invoice(0)
|
||||
|
||||
def tearDown(self):
|
||||
|
||||
@@ -13,6 +13,7 @@ from erpnext.crm.doctype.opportunity.test_opportunity import make_opportunity
|
||||
class TestTaxRule(IntegrationTestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
super().setUpClass()
|
||||
frappe.db.set_single_value("Shopping Cart Settings", "enabled", 0)
|
||||
|
||||
@classmethod
|
||||
|
||||
@@ -27,7 +27,8 @@ class UnitTestTaxWithholdingCategory(UnitTestCase):
|
||||
|
||||
class TestTaxWithholdingCategory(IntegrationTestCase):
|
||||
@classmethod
|
||||
def setUpClass(self):
|
||||
def setUpClass(cls):
|
||||
super().setUpClass()
|
||||
# create relevant supplier, etc
|
||||
create_records()
|
||||
create_tax_withholding_category_records()
|
||||
|
||||
@@ -14,9 +14,7 @@ from erpnext.accounts.utils import get_fiscal_year
|
||||
|
||||
|
||||
class TestDeferredRevenueAndExpense(IntegrationTestCase, AccountsTestMixin):
|
||||
@classmethod
|
||||
def setUpClass(self):
|
||||
self.maxDiff = None
|
||||
maxDiff = None
|
||||
|
||||
def clear_old_entries(self):
|
||||
sinv = qb.DocType("Sales Invoice")
|
||||
|
||||
@@ -17,7 +17,8 @@ EXTRA_TEST_RECORD_DEPENDENCIES = ["Sales Invoice"]
|
||||
|
||||
class TestSalesPaymentSummary(IntegrationTestCase):
|
||||
@classmethod
|
||||
def setUpClass(self):
|
||||
def setUpClass(cls):
|
||||
super().setUpClass()
|
||||
create_records()
|
||||
pes = frappe.get_all("Payment 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):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
super().setUpClass()
|
||||
set_depreciation_settings_in_company()
|
||||
create_asset_data()
|
||||
enable_cwip_accounting("Computers")
|
||||
|
||||
@@ -23,6 +23,7 @@ class UnitTestAssetShiftAllocation(UnitTestCase):
|
||||
class TestAssetShiftAllocation(IntegrationTestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
super().setUpClass()
|
||||
create_asset_shift_factors()
|
||||
|
||||
@classmethod
|
||||
|
||||
@@ -27,7 +27,9 @@ def create_test_appointment():
|
||||
|
||||
|
||||
class TestAppointment(IntegrationTestCase):
|
||||
def setUpClass():
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
super().setUpClass()
|
||||
frappe.db.delete("Lead", {"email_id": LEAD_EMAIL})
|
||||
|
||||
def setUp(self):
|
||||
|
||||
@@ -15,7 +15,8 @@ from erpnext.crm.report.sales_pipeline_analytics.test_sales_pipeline_analytics i
|
||||
|
||||
class TestOpportunitySummaryBySalesStage(IntegrationTestCase):
|
||||
@classmethod
|
||||
def setUpClass(self):
|
||||
def setUpClass(cls):
|
||||
super().setUpClass()
|
||||
create_company()
|
||||
create_customer()
|
||||
create_opportunity()
|
||||
|
||||
@@ -21,6 +21,7 @@ class UnitTestRouting(UnitTestCase):
|
||||
class TestRouting(IntegrationTestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
super().setUpClass()
|
||||
cls.item_code = "Test Routing Item - A"
|
||||
|
||||
@classmethod
|
||||
|
||||
@@ -16,17 +16,18 @@ months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct",
|
||||
|
||||
class TestIssueAnalytics(IntegrationTestCase):
|
||||
@classmethod
|
||||
def setUpClass(self):
|
||||
def setUpClass(cls):
|
||||
super().setUpClass()
|
||||
frappe.db.sql("delete from `tabIssue` where company='_Test Company'")
|
||||
frappe.db.set_single_value("Support Settings", "track_service_level_agreement", 1)
|
||||
|
||||
current_month_date = getdate()
|
||||
last_month_date = add_months(current_month_date, -1)
|
||||
self.current_month = str(months[current_month_date.month - 1]).lower()
|
||||
self.last_month = str(months[last_month_date.month - 1]).lower()
|
||||
cls.current_month = str(months[current_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:
|
||||
self.current_month += "_" + str(current_month_date.year)
|
||||
self.last_month += "_" + str(last_month_date.year)
|
||||
cls.current_month += "_" + str(current_month_date.year)
|
||||
cls.last_month += "_" + str(last_month_date.year)
|
||||
|
||||
def test_issue_analytics(self):
|
||||
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):
|
||||
@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):
|
||||
"""
|
||||
Test Stock and Service Item Search.
|
||||
|
||||
Reference in New Issue
Block a user