From c17de26e4453ec9e42c51967a245f85482931325 Mon Sep 17 00:00:00 2001 From: David Date: Fri, 11 Oct 2024 07:39:50 +0200 Subject: [PATCH] test: make tests independent of selling price validation --- erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py | 1 + .../pos_invoice_merge_log/test_pos_invoice_merge_log.py | 5 +++++ erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py | 1 + .../test_process_statement_of_accounts.py | 5 +++++ .../test_repost_accounting_ledger.py | 5 +++++ erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py | 3 ++- 6 files changed, 19 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py b/erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py index f4aadbca3b8..2644311e1c0 100644 --- a/erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py +++ b/erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py @@ -24,6 +24,7 @@ class TestPOSInvoice(IntegrationTestCase): @classmethod def setUpClass(cls): super().setUpClass() + cls.enterClassContext(cls.change_settings("Selling Settings", validate_selling_price=0)) make_stock_entry(target="_Test Warehouse - _TC", item_code="_Test Item", qty=800, basic_rate=100) frappe.db.sql("delete from `tabTax Rule`") diff --git a/erpnext/accounts/doctype/pos_invoice_merge_log/test_pos_invoice_merge_log.py b/erpnext/accounts/doctype/pos_invoice_merge_log/test_pos_invoice_merge_log.py index aa04a8af959..f29e382fa0e 100644 --- a/erpnext/accounts/doctype/pos_invoice_merge_log/test_pos_invoice_merge_log.py +++ b/erpnext/accounts/doctype/pos_invoice_merge_log/test_pos_invoice_merge_log.py @@ -28,6 +28,11 @@ class UnitTestPosInvoiceMergeLog(UnitTestCase): class TestPOSInvoiceMergeLog(IntegrationTestCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.enterClassContext(cls.change_settings("Selling Settings", validate_selling_price=0)) + def test_consolidated_invoice_creation(self): frappe.db.sql("delete from `tabPOS Invoice`") diff --git a/erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py b/erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py index 3b984221679..9f724db2039 100644 --- a/erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py +++ b/erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py @@ -28,6 +28,7 @@ class TestPricingRule(IntegrationTestCase): def setUp(self): delete_existing_pricing_rules() setup_pricing_rule_data() + self.enterClassContext(self.change_settings("Selling Settings", validate_selling_price=0)) def tearDown(self): delete_existing_pricing_rules() diff --git a/erpnext/accounts/doctype/process_statement_of_accounts/test_process_statement_of_accounts.py b/erpnext/accounts/doctype/process_statement_of_accounts/test_process_statement_of_accounts.py index 1419567a33e..260cb391d25 100644 --- a/erpnext/accounts/doctype/process_statement_of_accounts/test_process_statement_of_accounts.py +++ b/erpnext/accounts/doctype/process_statement_of_accounts/test_process_statement_of_accounts.py @@ -15,6 +15,11 @@ from erpnext.accounts.test.accounts_mixin import AccountsTestMixin class TestProcessStatementOfAccounts(AccountsTestMixin, IntegrationTestCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.enterClassContext(cls.change_settings("Selling Settings", validate_selling_price=0)) + def setUp(self): self.create_company() self.create_customer() diff --git a/erpnext/accounts/doctype/repost_accounting_ledger/test_repost_accounting_ledger.py b/erpnext/accounts/doctype/repost_accounting_ledger/test_repost_accounting_ledger.py index 2b59a746b1a..d8209ece675 100644 --- a/erpnext/accounts/doctype/repost_accounting_ledger/test_repost_accounting_ledger.py +++ b/erpnext/accounts/doctype/repost_accounting_ledger/test_repost_accounting_ledger.py @@ -15,6 +15,11 @@ from erpnext.accounts.utils import get_fiscal_year class TestRepostAccountingLedger(AccountsTestMixin, IntegrationTestCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.enterClassContext(cls.change_settings("Selling Settings", validate_selling_price=0)) + def setUp(self): self.create_company() self.create_customer() diff --git a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py index 02fae0cd580..dc438a36044 100644 --- a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py @@ -75,8 +75,9 @@ class TestSalesInvoice(IntegrationTestCase): return w @classmethod - def setUpClass(self): + def setUpClass(cls): super().setUpClass() + cls.enterClassContext(cls.change_settings("Selling Settings", validate_selling_price=0)) unlink_payment_on_cancel_of_invoice() @classmethod