From f1dfac417d4ca032d8eb4103b16fbf3ecd222bda Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Tue, 20 Jan 2026 10:12:06 +0530 Subject: [PATCH] refactor: replace IntegrationTestCase with ERPNextTestCase repo-wide - import ERPNextTestSuite - use it on test class --- .../accounts/doctype/account/test_account.py | 4 +- .../test_account_closing_balance.py | 5 ++- .../test_accounting_dimension.py | 4 +- .../test_accounting_dimension_filter.py | 3 +- .../test_accounting_period.py | 4 +- .../test_accounts_settings.py | 5 ++- .../test_advance_payment_ledger_entry.py | 6 +-- erpnext/accounts/doctype/bank/test_bank.py | 4 +- .../doctype/bank_account/test_bank_account.py | 6 +-- .../test_bank_account_subtype.py | 4 +- .../test_bank_account_type.py | 4 +- .../bank_clearance/test_bank_clearance.py | 5 +-- .../bank_guarantee/test_bank_guarantee.py | 4 +- .../test_bank_reconciliation_tool.py | 4 +- .../test_bank_statement_import.py | 5 +-- .../bank_transaction/test_auto_match_party.py | 4 +- .../bank_transaction/test_bank_transaction.py | 5 +-- .../test_bisect_accounting_statements.py | 6 ++- .../doctype/bisect_nodes/test_bisect_nodes.py | 6 ++- .../cashier_closing/test_cashier_closing.py | 4 +- .../test_chart_of_accounts_importer.py | 4 +- .../test_cheque_print_template.py | 4 +- .../doctype/cost_center/test_cost_center.py | 5 ++- .../test_cost_center_allocation.py | 6 +-- .../doctype/coupon_code/test_coupon_code.py | 4 +- .../test_currency_exchange_settings.py | 4 +- .../accounts/doctype/dunning/test_dunning.py | 4 +- .../doctype/dunning_type/test_dunning_type.py | 4 +- .../test_exchange_rate_revaluation.py | 12 +++--- .../doctype/finance_book/test_finance_book.py | 4 +- .../doctype/fiscal_year/test_fiscal_year.py | 5 ++- .../doctype/gl_entry/test_gl_entry.py | 4 +- .../test_invoice_discounting.py | 4 +- .../test_item_tax_template.py | 4 +- .../journal_entry/test_journal_entry.py | 8 ++-- .../test_journal_entry_template.py | 4 +- .../ledger_health/test_ledger_health.py | 4 +- .../test_ledger_health_monitor.py | 6 ++- .../doctype/ledger_merge/test_ledger_merge.py | 4 +- .../test_loyalty_point_entry.py | 4 +- .../loyalty_program/test_loyalty_program.py | 4 +- .../mode_of_payment/test_mode_of_payment.py | 5 ++- .../test_monthly_distribution.py | 5 +-- .../test_opening_invoice_creation_tool.py | 4 +- .../doctype/party_link/test_party_link.py | 4 +- .../payment_entry/test_payment_entry.py | 12 +++--- .../test_payment_gateway_account.py | 4 +- .../test_payment_ledger_entry.py | 10 ++--- .../payment_order/test_payment_order.py | 4 +- .../test_payment_reconciliation.py | 6 +-- .../payment_request/test_payment_request.py | 8 ++-- .../doctype/payment_term/test_payment_term.py | 4 +- .../test_payment_terms_template.py | 5 ++- .../test_period_closing_voucher.py | 4 +- .../test_pos_closing_entry.py | 6 +-- .../doctype/pos_invoice/test_pos_invoice.py | 4 +- .../test_pos_invoice_merge_log.py | 6 +-- .../test_pos_opening_entry.py | 6 ++- .../doctype/pos_profile/test_pos_profile.py | 4 +- .../pos_profile_user/test_pos_profile_user.py | 4 +- .../doctype/pos_settings/test_pos_settings.py | 4 +- .../doctype/pricing_rule/test_pricing_rule.py | 4 +- .../test_process_deferred_accounting.py | 4 +- .../test_process_payment_reconciliation.py | 6 ++- ...test_process_payment_reconciliation_log.py | 6 ++- .../test_process_statement_of_accounts.py | 4 +- .../test_process_subscription.py | 6 ++- .../test_promotional_scheme.py | 4 +- .../purchase_invoice/test_purchase_invoice.py | 26 +++++------- ...est_purchase_taxes_and_charges_template.py | 4 +- .../test_repost_accounting_ledger.py | 6 +-- .../test_repost_accounting_ledger_settings.py | 6 ++- .../test_repost_payment_ledger.py | 6 ++- .../sales_invoice/test_sales_invoice.py | 40 ++++++++----------- .../test_sales_taxes_and_charges_template.py | 5 +-- .../share_transfer/test_share_transfer.py | 4 +- .../doctype/share_type/test_share_type.py | 4 +- .../doctype/shareholder/test_shareholder.py | 4 +- .../shipping_rule/test_shipping_rule.py | 4 +- .../doctype/subscription/test_subscription.py | 6 +-- .../test_subscription_invoice.py | 4 +- .../test_subscription_plan.py | 4 +- .../test_subscription_settings.py | 4 +- .../doctype/tax_category/test_tax_category.py | 4 +- .../doctype/tax_rule/test_tax_rule.py | 4 +- .../test_tax_withholding_category.py | 8 ++-- .../test_unreconcile_payment.py | 4 +- .../account_balance/test_account_balance.py | 4 +- .../accounts_payable/test_accounts_payable.py | 4 +- .../test_accounts_receivable.py | 8 ++-- .../test_accounts_receivable_summary.py | 6 +-- .../balance_sheet/test_balance_sheet.py | 4 +- .../test_bank_reconciliation_statement.py | 5 +-- .../test_customer_ledger_summary.py | 6 +-- .../test_deferred_revenue_and_expense.py | 12 +++--- ...t_general_and_payment_ledger_comparison.py | 4 +- .../general_ledger/test_general_ledger.py | 4 +- .../report/gross_profit/test_gross_profit.py | 4 +- .../test_item_wise_purchase_register.py | 4 +- .../test_item_wise_sales_register.py | 4 +- .../payment_ledger/test_payment_ledger.py | 4 +- .../test_profit_and_loss_statement.py | 4 +- .../test_purchase_register.py | 4 +- .../test_sales_payment_summary.py | 4 +- .../sales_register/test_sales_register.py | 4 +- .../test_supplier_ledger_summary.py | 4 +- .../test_tax_withholding_details.py | 4 +- .../trial_balance/test_trial_balance.py | 4 +- erpnext/accounts/test/test_reports.py | 8 +--- erpnext/accounts/test/test_utils.py | 4 +- erpnext/accounts/test_party.py | 4 +- erpnext/assets/doctype/asset/test_asset.py | 4 +- .../asset_activity/test_asset_activity.py | 6 ++- .../test_asset_capitalization.py | 6 +-- .../asset_category/test_asset_category.py | 6 ++- .../test_asset_depreciation_schedule.py | 6 +-- .../test_asset_maintenance.py | 4 +- .../test_asset_maintenance_log.py | 4 +- .../test_asset_maintenance_team.py | 4 +- .../asset_movement/test_asset_movement.py | 4 +- .../doctype/asset_repair/test_asset_repair.py | 3 +- .../test_asset_shift_allocation.py | 4 +- .../test_asset_shift_factor.py | 6 ++- .../test_asset_value_adjustment.py | 4 +- .../assets/doctype/location/test_location.py | 5 ++- .../test_maintenance_team_member.py | 4 +- .../test_bulk_transaction_log.py | 6 ++- .../test_bulk_transaction_log_detail.py | 6 ++- .../buying_settings/test_buying_settings.py | 4 +- .../purchase_order/test_purchase_order.py | 23 ++++++----- .../test_request_for_quotation.py | 9 +++-- .../buying/doctype/supplier/test_supplier.py | 11 +++-- .../test_supplier_quotation.py | 7 ++-- .../test_supplier_scorecard.py | 5 ++- .../test_supplier_scorecard_criteria.py | 5 ++- .../test_supplier_scorecard_period.py | 4 +- .../test_supplier_scorecard_standing.py | 4 +- .../test_supplier_scorecard_variable.py | 4 +- .../test_procurement_tracker.py | 4 +- ...st_requested_items_to_order_and_receive.py | 4 +- .../test_subcontracted_item_to_be_received.py | 4 +- ...tracted_raw_materials_to_be_transferred.py | 4 +- .../tests/test_accounts_controller.py | 19 ++++----- .../tests/test_distributed_discount.py | 5 +-- .../controllers/tests/test_item_variant.py | 4 +- erpnext/controllers/tests/test_mapper.py | 5 ++- .../controllers/tests/test_qty_based_taxes.py | 5 ++- erpnext/controllers/tests/test_queries.py | 2 +- erpnext/controllers/tests/test_reactivity.py | 6 +-- .../tests/test_subcontracting_controller.py | 6 +-- .../tests/test_transaction_base.py | 5 ++- .../doctype/appointment/test_appointment.py | 5 ++- .../test_appointment_booking_settings.py | 4 +- erpnext/crm/doctype/campaign/test_campaign.py | 4 +- .../crm/doctype/competitor/test_competitor.py | 4 +- erpnext/crm/doctype/contract/test_contract.py | 5 ++- .../test_contract_fulfilment_checklist.py | 4 +- .../test_contract_template.py | 4 +- .../doctype/crm_settings/test_crm_settings.py | 4 +- .../email_campaign/test_email_campaign.py | 4 +- .../market_segment/test_market_segment.py | 4 +- .../opportunity_type/test_opportunity_type.py | 4 +- erpnext/crm/doctype/prospect/test_prospect.py | 4 +- .../doctype/sales_stage/test_sales_stage.py | 4 +- ...test_opportunity_summary_by_sales_stage.py | 8 +--- .../test_sales_pipeline_analytics.py | 4 +- .../plaid_settings/test_plaid_settings.py | 4 +- .../test_maintenance_schedule.py | 4 +- .../test_maintenance_visit.py | 5 ++- .../blanket_order/test_blanket_order.py | 4 +- erpnext/manufacturing/doctype/bom/test_bom.py | 5 ++- .../doctype/bom_creator/test_bom_creator.py | 4 +- .../bom_update_log/test_bom_update_log.py | 5 +-- .../bom_update_tool/test_bom_update_tool.py | 6 +-- .../downtime_entry/test_downtime_entry.py | 4 +- .../doctype/job_card/test_job_card.py | 13 +++--- .../test_manufacturing_settings.py | 4 +- .../test_material_request_plan_item.py | 4 +- .../doctype/operation/test_operation.py | 5 ++- .../doctype/plant_floor/test_plant_floor.py | 6 ++- .../production_plan/test_production_plan.py | 4 +- ...duction_plan_material_request_warehouse.py | 4 +- .../doctype/routing/test_routing.py | 4 +- .../sub_operation/test_sub_operation.py | 4 +- .../doctype/work_order/test_work_order.py | 23 +++++------ .../doctype/workstation/test_workstation.py | 4 +- .../workstation_type/test_workstation_type.py | 5 ++- .../test_bom_stock_calculated.py | 5 +-- .../bom_stock_report/test_bom_stock_report.py | 4 +- erpnext/manufacturing/report/test_reports.py | 5 +-- .../project_template/test_project_template.py | 4 +- .../doctype/project_type/test_project_type.py | 4 +- .../project_update/test_project_update.py | 5 +-- .../test_projects_settings.py | 4 +- .../doctype/task_type/test_task_type.py | 4 +- .../doctype/timesheet/test_timesheet.py | 3 +- .../test_delayed_tasks_summary.py | 4 +- .../non_conformance/test_non_conformance.py | 4 +- .../quality_action/test_quality_action.py | 4 +- .../quality_feedback/test_quality_feedback.py | 5 ++- .../test_quality_feedback_template.py | 4 +- .../doctype/quality_goal/test_quality_goal.py | 5 ++- .../quality_meeting/test_quality_meeting.py | 4 +- .../test_quality_meeting_agenda.py | 4 +- .../test_quality_procedure.py | 5 ++- .../quality_review/test_quality_review.py | 5 ++- .../test_import_supplier_invoice.py | 4 +- .../test_lower_deduction_certificate.py | 4 +- .../test_south_africa_vat_settings.py | 4 +- .../uae_vat_settings/test_uae_vat_settings.py | 4 +- .../united_states/test_united_states.py | 4 +- .../selling/doctype/customer/test_customer.py | 5 +-- .../test_installation_note.py | 4 +- .../test_party_specific_item.py | 4 +- .../doctype/quotation/test_quotation.py | 16 ++++---- .../doctype/sales_order/test_sales_order.py | 29 +++++++------- .../test_sales_partner_type.py | 4 +- .../selling_settings/test_selling_settings.py | 5 ++- ...st_payment_terms_status_for_sales_order.py | 6 +-- ...t_pending_so_items_for_purchase_request.py | 4 +- .../report/sales_analytics/test_analytics.py | 4 +- .../test_sales_order_analysis.py | 4 +- ...ner_target_variance_based_on_item_group.py | 4 +- ...son_target_variance_based_on_item_group.py | 4 +- .../test_authorization_rule.py | 4 +- .../test_currency_exchange.py | 4 +- .../doctype/department/test_department.py | 5 ++- erpnext/setup/doctype/driver/test_driver.py | 4 +- .../doctype/email_digest/test_email_digest.py | 4 +- .../setup/doctype/employee/test_employee.py | 4 +- .../employee_group/test_employee_group.py | 4 +- .../global_defaults/test_global_defaults.py | 4 +- .../doctype/holiday_list/test_holiday_list.py | 4 +- .../setup/doctype/incoterm/test_incoterm.py | 6 ++- .../doctype/item_group/test_item_group.py | 5 ++- .../doctype/party_type/test_party_type.py | 4 +- .../test_transaction_deletion_record.py | 5 ++- .../test_uom_conversion_factor.py | 4 +- erpnext/setup/doctype/vehicle/test_vehicle.py | 5 ++- erpnext/stock/doctype/batch/test_batch.py | 4 +- erpnext/stock/doctype/bin/test_bin.py | 4 +- .../test_customs_tariff_number.py | 4 +- .../delivery_note/test_delivery_note.py | 10 ++--- .../test_delivery_settings.py | 4 +- .../delivery_trip/test_delivery_trip.py | 5 +-- .../test_inventory_dimension.py | 6 +-- erpnext/stock/doctype/item/test_item.py | 12 +++--- .../item_alternative/test_item_alternative.py | 4 +- .../item_attribute/test_item_attribute.py | 4 +- .../test_item_manufacturer.py | 4 +- .../doctype/item_price/test_item_price.py | 4 +- .../test_item_variant_settings.py | 4 +- .../test_landed_cost_voucher.py | 5 +-- .../doctype/manufacturer/test_manufacturer.py | 4 +- .../material_request/test_material_request.py | 4 +- .../doctype/packed_item/test_packed_item.py | 6 +-- .../doctype/packing_slip/test_packing_slip.py | 4 +- .../stock/doctype/pick_list/test_pick_list.py | 4 +- .../purchase_receipt/test_purchase_receipt.py | 14 +++---- .../doctype/putaway_rule/test_putaway_rule.py | 4 +- .../test_quality_inspection.py | 6 +-- .../test_quality_inspection_parameter.py | 4 +- ...test_quality_inspection_parameter_group.py | 4 +- .../test_quality_inspection_template.py | 4 +- .../test_repost_item_valuation.py | 8 ++-- .../test_serial_and_batch_bundle.py | 6 +-- .../stock/doctype/serial_no/test_serial_no.py | 4 +- .../stock/doctype/shipment/test_shipment.py | 4 +- .../test_shipment_parcel_template.py | 4 +- .../test_stock_closing_balance.py | 6 +-- .../test_stock_closing_entry.py | 7 ++-- .../doctype/stock_entry/test_stock_entry.py | 16 ++++---- .../stock_entry_type/test_stock_entry_type.py | 5 ++- .../test_stock_ledger_entry.py | 12 +++--- .../test_stock_reconciliation.py | 12 +++--- .../test_stock_reposting_settings.py | 4 +- .../test_stock_reservation_entry.py | 22 +++++----- .../stock_settings/test_stock_settings.py | 5 ++- .../doctype/uom_category/test_uom_category.py | 4 +- .../variant_field/test_variant_field.py | 4 +- .../stock/doctype/warehouse/test_warehouse.py | 4 +- .../warehouse_type/test_warehouse_type.py | 4 +- .../test_available_serial_no.py | 4 +- .../test_item_shortage_report.py | 4 +- .../reserved_stock/test_reserved_stock.py | 6 +-- .../report/stock_ageing/test_stock_ageing.py | 4 +- .../stock_analytics/test_stock_analytics.py | 4 +- .../stock_balance/test_stock_balance.py | 4 +- .../stock_ledger/test_stock_ledger_report.py | 4 +- erpnext/stock/report/test_reports.py | 8 +--- erpnext/stock/tests/test_get_item_details.py | 4 +- erpnext/stock/tests/test_utils.py | 4 +- erpnext/stock/tests/test_valuation.py | 8 ++-- .../test_subcontracting_bom.py | 5 ++- .../test_subcontracting_inward_order.py | 18 +++------ .../test_subcontracting_order.py | 4 +- .../test_subcontracting_receipt.py | 14 +++---- erpnext/support/doctype/issue/test_issue.py | 4 +- .../issue_priority/test_issue_priority.py | 5 ++- .../doctype/issue_type/test_issue_type.py | 4 +- .../test_service_level_agreement.py | 4 +- .../support_settings/test_support_settings.py | 4 +- .../warranty_claim/test_warranty_claim.py | 5 +-- .../issue_analytics/test_issue_analytics.py | 4 +- .../doctype/call_log/test_call_log.py | 4 +- .../test_incoming_call_settings.py | 4 +- .../test_telephony_call_type.py | 4 +- .../test_voice_call_settings.py | 4 +- erpnext/tests/test_activation.py | 5 +-- erpnext/tests/test_init.py | 8 +--- erpnext/tests/test_notifications.py | 5 ++- erpnext/tests/test_perf.py | 5 ++- erpnext/tests/test_point_of_sale.py | 6 +-- erpnext/tests/test_regional.py | 4 +- erpnext/tests/test_webform.py | 4 +- erpnext/tests/test_zform_loads.py | 7 ++-- erpnext/tests/utils.py | 1 - erpnext/utilities/doctype/video/test_video.py | 4 +- .../video_settings/test_video_settings.py | 4 +- 319 files changed, 870 insertions(+), 867 deletions(-) diff --git a/erpnext/accounts/doctype/account/test_account.py b/erpnext/accounts/doctype/account/test_account.py index 5bd600d99be..95f17967fa7 100644 --- a/erpnext/accounts/doctype/account/test_account.py +++ b/erpnext/accounts/doctype/account/test_account.py @@ -3,7 +3,6 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import nowdate from erpnext.accounts.doctype.account.account import ( @@ -12,9 +11,10 @@ from erpnext.accounts.doctype.account.account import ( update_account_number, ) from erpnext.stock import get_company_default_inventory_account, get_warehouse_account +from erpnext.tests.utils import ERPNextTestSuite -class TestAccount(IntegrationTestCase): +class TestAccount(ERPNextTestSuite): def test_rename_account(self): if not frappe.db.exists("Account", "1210 - Debtors - _TC"): acc = frappe.new_doc("Account") diff --git a/erpnext/accounts/doctype/account_closing_balance/test_account_closing_balance.py b/erpnext/accounts/doctype/account_closing_balance/test_account_closing_balance.py index 53f4e5d15af..a39bd00579e 100644 --- a/erpnext/accounts/doctype/account_closing_balance/test_account_closing_balance.py +++ b/erpnext/accounts/doctype/account_closing_balance/test_account_closing_balance.py @@ -2,8 +2,9 @@ # See license.txt # import frappe -from frappe.tests import IntegrationTestCase + +from erpnext.tests.utils import ERPNextTestSuite -class TestAccountClosingBalance(IntegrationTestCase): +class TestAccountClosingBalance(ERPNextTestSuite): pass diff --git a/erpnext/accounts/doctype/accounting_dimension/test_accounting_dimension.py b/erpnext/accounts/doctype/accounting_dimension/test_accounting_dimension.py index a9eaf0b1402..c16c8c28c32 100644 --- a/erpnext/accounts/doctype/accounting_dimension/test_accounting_dimension.py +++ b/erpnext/accounts/doctype/accounting_dimension/test_accounting_dimension.py @@ -3,13 +3,13 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from erpnext.accounts.doctype.journal_entry.test_journal_entry import make_journal_entry from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice +from erpnext.tests.utils import ERPNextTestSuite -class TestAccountingDimension(IntegrationTestCase): +class TestAccountingDimension(ERPNextTestSuite): def setUp(self): create_dimension() diff --git a/erpnext/accounts/doctype/accounting_dimension_filter/test_accounting_dimension_filter.py b/erpnext/accounts/doctype/accounting_dimension_filter/test_accounting_dimension_filter.py index cdc0d7452ad..6ea3ebc7b2d 100644 --- a/erpnext/accounts/doctype/accounting_dimension_filter/test_accounting_dimension_filter.py +++ b/erpnext/accounts/doctype/accounting_dimension_filter/test_accounting_dimension_filter.py @@ -11,9 +11,10 @@ from erpnext.accounts.doctype.accounting_dimension.test_accounting_dimension imp ) from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice from erpnext.exceptions import InvalidAccountDimensionError, MandatoryAccountDimensionError +from erpnext.tests.utils import ERPNextTestSuite -class TestAccountingDimensionFilter(unittest.TestCase): +class TestAccountingDimensionFilter(ERPNextTestSuite): def setUp(self): create_dimension() create_accounting_dimension_filter() diff --git a/erpnext/accounts/doctype/accounting_period/test_accounting_period.py b/erpnext/accounts/doctype/accounting_period/test_accounting_period.py index cdd8251281e..448b6cf7e2f 100644 --- a/erpnext/accounts/doctype/accounting_period/test_accounting_period.py +++ b/erpnext/accounts/doctype/accounting_period/test_accounting_period.py @@ -3,7 +3,6 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import add_months, nowdate from erpnext.accounts.doctype.accounting_period.accounting_period import ( @@ -11,9 +10,10 @@ from erpnext.accounts.doctype.accounting_period.accounting_period import ( OverlapError, ) from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice +from erpnext.tests.utils import ERPNextTestSuite -class TestAccountingPeriod(IntegrationTestCase): +class TestAccountingPeriod(ERPNextTestSuite): def test_overlap(self): ap1 = create_accounting_period( start_date="2018-04-01", end_date="2018-06-30", company="Wind Power LLC" diff --git a/erpnext/accounts/doctype/accounts_settings/test_accounts_settings.py b/erpnext/accounts/doctype/accounts_settings/test_accounts_settings.py index e555f0ded15..57b020a24dc 100644 --- a/erpnext/accounts/doctype/accounts_settings/test_accounts_settings.py +++ b/erpnext/accounts/doctype/accounts_settings/test_accounts_settings.py @@ -1,10 +1,11 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase + +from erpnext.tests.utils import ERPNextTestSuite -class TestAccountsSettings(IntegrationTestCase): +class TestAccountsSettings(ERPNextTestSuite): def tearDown(self): # Just in case `save` method succeeds, we need to take things back to default so that other tests # don't break diff --git a/erpnext/accounts/doctype/advance_payment_ledger_entry/test_advance_payment_ledger_entry.py b/erpnext/accounts/doctype/advance_payment_ledger_entry/test_advance_payment_ledger_entry.py index e8562922ada..08cd7c9504c 100644 --- a/erpnext/accounts/doctype/advance_payment_ledger_entry/test_advance_payment_ledger_entry.py +++ b/erpnext/accounts/doctype/advance_payment_ledger_entry/test_advance_payment_ledger_entry.py @@ -2,7 +2,6 @@ # See license.txt import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import nowdate, today from erpnext.accounts.doctype.payment_entry.test_payment_entry import get_payment_entry @@ -10,12 +9,13 @@ from erpnext.accounts.test.accounts_mixin import AccountsTestMixin from erpnext.buying.doctype.purchase_order.test_purchase_order import create_purchase_order from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order -# On IntegrationTestCase, the doctype test records and all +# On ERPNextTestSuite, the doctype test records and all # link-field test record depdendencies are recursively loaded # Use these module variables to add/remove to/from that list +from erpnext.tests.utils import ERPNextTestSuite -class TestAdvancePaymentLedgerEntry(AccountsTestMixin, IntegrationTestCase): +class TestAdvancePaymentLedgerEntry(AccountsTestMixin, ERPNextTestSuite): """ Integration tests for AdvancePaymentLedgerEntry. Use this class for testing interactions between multiple components. diff --git a/erpnext/accounts/doctype/bank/test_bank.py b/erpnext/accounts/doctype/bank/test_bank.py index 98e83fd5837..1249b6cc34a 100644 --- a/erpnext/accounts/doctype/bank/test_bank.py +++ b/erpnext/accounts/doctype/bank/test_bank.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestBank(IntegrationTestCase): +class TestBank(ERPNextTestSuite): pass diff --git a/erpnext/accounts/doctype/bank_account/test_bank_account.py b/erpnext/accounts/doctype/bank_account/test_bank_account.py index 146f426e6c7..0645a110140 100644 --- a/erpnext/accounts/doctype/bank_account/test_bank_account.py +++ b/erpnext/accounts/doctype/bank_account/test_bank_account.py @@ -2,10 +2,8 @@ # See license.txt import unittest -import frappe -from frappe import ValidationError -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestBankAccount(IntegrationTestCase): +class TestBankAccount(ERPNextTestSuite): pass diff --git a/erpnext/accounts/doctype/bank_account_subtype/test_bank_account_subtype.py b/erpnext/accounts/doctype/bank_account_subtype/test_bank_account_subtype.py index d4a6c689bc3..0e6a2c52138 100644 --- a/erpnext/accounts/doctype/bank_account_subtype/test_bank_account_subtype.py +++ b/erpnext/accounts/doctype/bank_account_subtype/test_bank_account_subtype.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestBankAccountSubtype(IntegrationTestCase): +class TestBankAccountSubtype(ERPNextTestSuite): pass diff --git a/erpnext/accounts/doctype/bank_account_type/test_bank_account_type.py b/erpnext/accounts/doctype/bank_account_type/test_bank_account_type.py index 0d41686da59..0b602b3b9d6 100644 --- a/erpnext/accounts/doctype/bank_account_type/test_bank_account_type.py +++ b/erpnext/accounts/doctype/bank_account_type/test_bank_account_type.py @@ -3,8 +3,8 @@ # import frappe import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestBankAccountType(IntegrationTestCase): +class TestBankAccountType(ERPNextTestSuite): pass diff --git a/erpnext/accounts/doctype/bank_clearance/test_bank_clearance.py b/erpnext/accounts/doctype/bank_clearance/test_bank_clearance.py index dda65594554..2774cc55685 100644 --- a/erpnext/accounts/doctype/bank_clearance/test_bank_clearance.py +++ b/erpnext/accounts/doctype/bank_clearance/test_bank_clearance.py @@ -3,7 +3,6 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import add_months, getdate from erpnext.accounts.doctype.cost_center.test_cost_center import create_cost_center @@ -15,10 +14,10 @@ from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import make from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice from erpnext.stock.doctype.item.test_item import create_item from erpnext.stock.doctype.warehouse.test_warehouse import create_warehouse -from erpnext.tests.utils import if_lending_app_installed, if_lending_app_not_installed +from erpnext.tests.utils import ERPNextTestSuite, if_lending_app_installed, if_lending_app_not_installed -class TestBankClearance(IntegrationTestCase): +class TestBankClearance(ERPNextTestSuite): @classmethod def setUpClass(cls): super().setUpClass() diff --git a/erpnext/accounts/doctype/bank_guarantee/test_bank_guarantee.py b/erpnext/accounts/doctype/bank_guarantee/test_bank_guarantee.py index eaf55ce7708..72dad011e56 100644 --- a/erpnext/accounts/doctype/bank_guarantee/test_bank_guarantee.py +++ b/erpnext/accounts/doctype/bank_guarantee/test_bank_guarantee.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestBankGuarantee(IntegrationTestCase): +class TestBankGuarantee(ERPNextTestSuite): pass diff --git a/erpnext/accounts/doctype/bank_reconciliation_tool/test_bank_reconciliation_tool.py b/erpnext/accounts/doctype/bank_reconciliation_tool/test_bank_reconciliation_tool.py index 53586b333b4..9c5bcef0933 100644 --- a/erpnext/accounts/doctype/bank_reconciliation_tool/test_bank_reconciliation_tool.py +++ b/erpnext/accounts/doctype/bank_reconciliation_tool/test_bank_reconciliation_tool.py @@ -4,7 +4,6 @@ import frappe from frappe import qb -from frappe.tests import IntegrationTestCase from frappe.utils import add_days, today from erpnext.accounts.doctype.bank_reconciliation_tool.bank_reconciliation_tool import ( @@ -13,9 +12,10 @@ from erpnext.accounts.doctype.bank_reconciliation_tool.bank_reconciliation_tool ) from erpnext.accounts.doctype.payment_entry.test_payment_entry import create_payment_entry from erpnext.accounts.test.accounts_mixin import AccountsTestMixin +from erpnext.tests.utils import ERPNextTestSuite -class TestBankReconciliationTool(AccountsTestMixin, IntegrationTestCase): +class TestBankReconciliationTool(AccountsTestMixin, ERPNextTestSuite): def setUp(self): self.create_company() self.create_customer() diff --git a/erpnext/accounts/doctype/bank_statement_import/test_bank_statement_import.py b/erpnext/accounts/doctype/bank_statement_import/test_bank_statement_import.py index 3e1cee9115e..2ae00059c83 100644 --- a/erpnext/accounts/doctype/bank_statement_import/test_bank_statement_import.py +++ b/erpnext/accounts/doctype/bank_statement_import/test_bank_statement_import.py @@ -1,15 +1,14 @@ # Copyright (c) 2020, Frappe Technologies and Contributors # See license.txt -import unittest - from erpnext.accounts.doctype.bank_statement_import.bank_statement_import import ( is_mt940_format, preprocess_mt940_content, ) +from erpnext.tests.utils import ERPNextTestSuite -class TestBankStatementImport(unittest.TestCase): +class TestBankStatementImport(ERPNextTestSuite): """Unit tests for Bank Statement Import functions""" def test_preprocess_mt940_content_with_long_statement_number(self): diff --git a/erpnext/accounts/doctype/bank_transaction/test_auto_match_party.py b/erpnext/accounts/doctype/bank_transaction/test_auto_match_party.py index da2c28a148c..81407aaf06b 100644 --- a/erpnext/accounts/doctype/bank_transaction/test_auto_match_party.py +++ b/erpnext/accounts/doctype/bank_transaction/test_auto_match_party.py @@ -2,16 +2,16 @@ # License: GNU General Public License v3. See license.txt import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import nowdate from erpnext.accounts.doctype.bank_transaction.test_bank_transaction import create_bank_account +from erpnext.tests.utils import ERPNextTestSuite IBAN_1 = "DE02000000003716541159" IBAN_2 = "DE02500105170137075030" -class TestAutoMatchParty(IntegrationTestCase): +class TestAutoMatchParty(ERPNextTestSuite): @classmethod def setUpClass(cls): create_bank_account() diff --git a/erpnext/accounts/doctype/bank_transaction/test_bank_transaction.py b/erpnext/accounts/doctype/bank_transaction/test_bank_transaction.py index 31a0a896af4..c69d255c51a 100644 --- a/erpnext/accounts/doctype/bank_transaction/test_bank_transaction.py +++ b/erpnext/accounts/doctype/bank_transaction/test_bank_transaction.py @@ -6,7 +6,6 @@ import json import frappe from frappe import utils from frappe.model.docstatus import DocStatus -from frappe.tests import IntegrationTestCase from erpnext.accounts.doctype.bank_reconciliation_tool.bank_reconciliation_tool import ( get_linked_payments, @@ -19,10 +18,10 @@ from erpnext.accounts.doctype.payment_entry.test_payment_entry import get_paymen from erpnext.accounts.doctype.pos_profile.test_pos_profile import make_pos_profile from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import make_purchase_invoice from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice -from erpnext.tests.utils import if_lending_app_installed +from erpnext.tests.utils import ERPNextTestSuite, if_lending_app_installed -class TestBankTransaction(IntegrationTestCase): +class TestBankTransaction(ERPNextTestSuite): def setUp(self): make_pos_profile() diff --git a/erpnext/accounts/doctype/bisect_accounting_statements/test_bisect_accounting_statements.py b/erpnext/accounts/doctype/bisect_accounting_statements/test_bisect_accounting_statements.py index fd1793b2560..55e4811a87f 100644 --- a/erpnext/accounts/doctype/bisect_accounting_statements/test_bisect_accounting_statements.py +++ b/erpnext/accounts/doctype/bisect_accounting_statements/test_bisect_accounting_statements.py @@ -2,8 +2,10 @@ # See license.txt # import frappe -from frappe.tests import IntegrationTestCase -class TestBisectAccountingStatements(IntegrationTestCase): +from erpnext.tests.utils import ERPNextTestSuite + + +class TestBisectAccountingStatements(ERPNextTestSuite): pass diff --git a/erpnext/accounts/doctype/bisect_nodes/test_bisect_nodes.py b/erpnext/accounts/doctype/bisect_nodes/test_bisect_nodes.py index 1f37009d8e2..082b2a28f1f 100644 --- a/erpnext/accounts/doctype/bisect_nodes/test_bisect_nodes.py +++ b/erpnext/accounts/doctype/bisect_nodes/test_bisect_nodes.py @@ -2,8 +2,10 @@ # See license.txt # import frappe -from frappe.tests import IntegrationTestCase -class TestBisectNodes(IntegrationTestCase): +from erpnext.tests.utils import ERPNextTestSuite + + +class TestBisectNodes(ERPNextTestSuite): pass diff --git a/erpnext/accounts/doctype/cashier_closing/test_cashier_closing.py b/erpnext/accounts/doctype/cashier_closing/test_cashier_closing.py index 56cf2b53919..1c826e31add 100644 --- a/erpnext/accounts/doctype/cashier_closing/test_cashier_closing.py +++ b/erpnext/accounts/doctype/cashier_closing/test_cashier_closing.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestCashierClosing(IntegrationTestCase): +class TestCashierClosing(ERPNextTestSuite): pass diff --git a/erpnext/accounts/doctype/chart_of_accounts_importer/test_chart_of_accounts_importer.py b/erpnext/accounts/doctype/chart_of_accounts_importer/test_chart_of_accounts_importer.py index 214de348169..f96d46e90a9 100644 --- a/erpnext/accounts/doctype/chart_of_accounts_importer/test_chart_of_accounts_importer.py +++ b/erpnext/accounts/doctype/chart_of_accounts_importer/test_chart_of_accounts_importer.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestChartofAccountsImporter(IntegrationTestCase): +class TestChartofAccountsImporter(ERPNextTestSuite): pass diff --git a/erpnext/accounts/doctype/cheque_print_template/test_cheque_print_template.py b/erpnext/accounts/doctype/cheque_print_template/test_cheque_print_template.py index b7ee19d4422..54c62141e1c 100644 --- a/erpnext/accounts/doctype/cheque_print_template/test_cheque_print_template.py +++ b/erpnext/accounts/doctype/cheque_print_template/test_cheque_print_template.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestChequePrintTemplate(IntegrationTestCase): +class TestChequePrintTemplate(ERPNextTestSuite): pass diff --git a/erpnext/accounts/doctype/cost_center/test_cost_center.py b/erpnext/accounts/doctype/cost_center/test_cost_center.py index 375541a3960..cfde7238eab 100644 --- a/erpnext/accounts/doctype/cost_center/test_cost_center.py +++ b/erpnext/accounts/doctype/cost_center/test_cost_center.py @@ -3,10 +3,11 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase + +from erpnext.tests.utils import ERPNextTestSuite -class TestCostCenter(IntegrationTestCase): +class TestCostCenter(ERPNextTestSuite): def test_cost_center_creation_against_child_node(self): cost_center = frappe.get_doc( { diff --git a/erpnext/accounts/doctype/cost_center_allocation/test_cost_center_allocation.py b/erpnext/accounts/doctype/cost_center_allocation/test_cost_center_allocation.py index 680e2113ec1..4047e6c7169 100644 --- a/erpnext/accounts/doctype/cost_center_allocation/test_cost_center_allocation.py +++ b/erpnext/accounts/doctype/cost_center_allocation/test_cost_center_allocation.py @@ -4,7 +4,6 @@ import unittest import frappe from frappe.query_builder.functions import Sum -from frappe.tests import IntegrationTestCase from frappe.utils import add_days, today from erpnext.accounts.doctype.cost_center.test_cost_center import create_cost_center @@ -16,9 +15,10 @@ from erpnext.accounts.doctype.cost_center_allocation.cost_center_allocation impo WrongPercentageAllocation, ) from erpnext.accounts.doctype.journal_entry.test_journal_entry import make_journal_entry +from erpnext.tests.utils import ERPNextTestSuite -class TestCostCenterAllocation(IntegrationTestCase): +class TestCostCenterAllocation(ERPNextTestSuite): def setUp(self): cost_centers = [ "Main Cost Center 1", @@ -191,7 +191,7 @@ class TestCostCenterAllocation(IntegrationTestCase): coa2.cancel() jv.cancel() - @IntegrationTestCase.change_settings("System Settings", {"rounding_method": "Commercial Rounding"}) + @ERPNextTestSuite.change_settings("System Settings", {"rounding_method": "Commercial Rounding"}) def test_debit_credit_on_cost_center_allocation_for_commercial_rounding(self): from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice diff --git a/erpnext/accounts/doctype/coupon_code/test_coupon_code.py b/erpnext/accounts/doctype/coupon_code/test_coupon_code.py index 146cb6984f7..936eac018e3 100644 --- a/erpnext/accounts/doctype/coupon_code/test_coupon_code.py +++ b/erpnext/accounts/doctype/coupon_code/test_coupon_code.py @@ -3,9 +3,9 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order +from erpnext.tests.utils import ERPNextTestSuite def test_create_test_data(): @@ -108,7 +108,7 @@ def test_create_test_data(): coupon_code.insert() -class TestCouponCode(IntegrationTestCase): +class TestCouponCode(ERPNextTestSuite): def setUp(self): test_create_test_data() diff --git a/erpnext/accounts/doctype/currency_exchange_settings/test_currency_exchange_settings.py b/erpnext/accounts/doctype/currency_exchange_settings/test_currency_exchange_settings.py index 3097f72d628..0c1c163a398 100644 --- a/erpnext/accounts/doctype/currency_exchange_settings/test_currency_exchange_settings.py +++ b/erpnext/accounts/doctype/currency_exchange_settings/test_currency_exchange_settings.py @@ -3,8 +3,8 @@ # import frappe import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestCurrencyExchangeSettings(IntegrationTestCase): +class TestCurrencyExchangeSettings(ERPNextTestSuite): pass diff --git a/erpnext/accounts/doctype/dunning/test_dunning.py b/erpnext/accounts/doctype/dunning/test_dunning.py index feb92c70e76..f6bfa1453da 100644 --- a/erpnext/accounts/doctype/dunning/test_dunning.py +++ b/erpnext/accounts/doctype/dunning/test_dunning.py @@ -4,7 +4,6 @@ import json import frappe from frappe.model import mapper -from frappe.tests import IntegrationTestCase from frappe.utils import add_days, nowdate, today from erpnext import get_default_cost_center @@ -18,9 +17,10 @@ from erpnext.accounts.doctype.sales_invoice.sales_invoice import ( from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import ( create_sales_invoice_against_cost_center, ) +from erpnext.tests.utils import ERPNextTestSuite -class TestDunning(IntegrationTestCase): +class TestDunning(ERPNextTestSuite): @classmethod def setUpClass(cls): super().setUpClass() diff --git a/erpnext/accounts/doctype/dunning_type/test_dunning_type.py b/erpnext/accounts/doctype/dunning_type/test_dunning_type.py index 5a95aa68ea9..4cf60c86600 100644 --- a/erpnext/accounts/doctype/dunning_type/test_dunning_type.py +++ b/erpnext/accounts/doctype/dunning_type/test_dunning_type.py @@ -3,8 +3,8 @@ # import frappe import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestDunningType(IntegrationTestCase): +class TestDunningType(ERPNextTestSuite): pass diff --git a/erpnext/accounts/doctype/exchange_rate_revaluation/test_exchange_rate_revaluation.py b/erpnext/accounts/doctype/exchange_rate_revaluation/test_exchange_rate_revaluation.py index 96079284dd9..24aa5a628fd 100644 --- a/erpnext/accounts/doctype/exchange_rate_revaluation/test_exchange_rate_revaluation.py +++ b/erpnext/accounts/doctype/exchange_rate_revaluation/test_exchange_rate_revaluation.py @@ -5,15 +5,15 @@ import frappe from frappe.query_builder import functions from frappe.query_builder.utils import DocType -from frappe.tests import IntegrationTestCase from frappe.utils import add_days, flt, today from erpnext.accounts.doctype.payment_entry.payment_entry import get_payment_entry from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice from erpnext.accounts.test.accounts_mixin import AccountsTestMixin +from erpnext.tests.utils import ERPNextTestSuite -class TestExchangeRateRevaluation(AccountsTestMixin, IntegrationTestCase): +class TestExchangeRateRevaluation(AccountsTestMixin, ERPNextTestSuite): def setUp(self): self.create_company() self.create_usd_receivable_account() @@ -37,7 +37,7 @@ class TestExchangeRateRevaluation(AccountsTestMixin, IntegrationTestCase): company_doc.unrealized_exchange_gain_loss_account = company_doc.exchange_gain_loss_account company_doc.save() - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Accounts Settings", {"allow_multi_currency_invoices_against_single_party_account": 1, "allow_stale": 0}, ) @@ -91,7 +91,7 @@ class TestExchangeRateRevaluation(AccountsTestMixin, IntegrationTestCase): )[0] self.assertEqual(acc_balance.balance, 8500.0) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Accounts Settings", {"allow_multi_currency_invoices_against_single_party_account": 1, "allow_stale": 0}, ) @@ -164,7 +164,7 @@ class TestExchangeRateRevaluation(AccountsTestMixin, IntegrationTestCase): self.assertEqual(acc_balance.balance, 0.0) self.assertEqual(acc_balance.balance_in_account_currency, 0.0) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Accounts Settings", {"allow_multi_currency_invoices_against_single_party_account": 1, "allow_stale": 0}, ) @@ -259,7 +259,7 @@ class TestExchangeRateRevaluation(AccountsTestMixin, IntegrationTestCase): self.assertEqual(flt(acc_balance.balance, precision), 0.0) self.assertEqual(flt(acc_balance.balance_in_account_currency, precision), 0.0) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Accounts Settings", {"allow_multi_currency_invoices_against_single_party_account": 1, "allow_stale": 0}, ) diff --git a/erpnext/accounts/doctype/finance_book/test_finance_book.py b/erpnext/accounts/doctype/finance_book/test_finance_book.py index e2c156a1df5..e803eabf93a 100644 --- a/erpnext/accounts/doctype/finance_book/test_finance_book.py +++ b/erpnext/accounts/doctype/finance_book/test_finance_book.py @@ -3,12 +3,12 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from erpnext.accounts.doctype.journal_entry.test_journal_entry import make_journal_entry +from erpnext.tests.utils import ERPNextTestSuite -class TestFinanceBook(IntegrationTestCase): +class TestFinanceBook(ERPNextTestSuite): def test_finance_book(self): finance_book = create_finance_book() diff --git a/erpnext/accounts/doctype/fiscal_year/test_fiscal_year.py b/erpnext/accounts/doctype/fiscal_year/test_fiscal_year.py index 1ceffa90940..b6ce0696bdb 100644 --- a/erpnext/accounts/doctype/fiscal_year/test_fiscal_year.py +++ b/erpnext/accounts/doctype/fiscal_year/test_fiscal_year.py @@ -3,11 +3,12 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import now_datetime +from erpnext.tests.utils import ERPNextTestSuite -class TestFiscalYear(IntegrationTestCase): + +class TestFiscalYear(ERPNextTestSuite): def test_extra_year(self): if frappe.db.exists("Fiscal Year", "_Test Fiscal Year 2000"): frappe.delete_doc("Fiscal Year", "_Test Fiscal Year 2000") diff --git a/erpnext/accounts/doctype/gl_entry/test_gl_entry.py b/erpnext/accounts/doctype/gl_entry/test_gl_entry.py index 11269f005db..bd391b4b8f4 100644 --- a/erpnext/accounts/doctype/gl_entry/test_gl_entry.py +++ b/erpnext/accounts/doctype/gl_entry/test_gl_entry.py @@ -4,13 +4,13 @@ import unittest import frappe from frappe.model.naming import parse_naming_series -from frappe.tests import IntegrationTestCase from erpnext.accounts.doctype.gl_entry.gl_entry import rename_gle_sle_docs from erpnext.accounts.doctype.journal_entry.test_journal_entry import make_journal_entry +from erpnext.tests.utils import ERPNextTestSuite -class TestGLEntry(IntegrationTestCase): +class TestGLEntry(ERPNextTestSuite): def test_round_off_entry(self): frappe.db.set_value("Company", "_Test Company", "round_off_account", "_Test Write Off - _TC") frappe.db.set_value("Company", "_Test Company", "round_off_cost_center", "_Test Cost Center - _TC") diff --git a/erpnext/accounts/doctype/invoice_discounting/test_invoice_discounting.py b/erpnext/accounts/doctype/invoice_discounting/test_invoice_discounting.py index f34e2fd2434..00946e5fec1 100644 --- a/erpnext/accounts/doctype/invoice_discounting/test_invoice_discounting.py +++ b/erpnext/accounts/doctype/invoice_discounting/test_invoice_discounting.py @@ -3,16 +3,16 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import add_days, flt, nowdate from erpnext.accounts.doctype.account.test_account import create_account from erpnext.accounts.doctype.journal_entry.journal_entry import get_payment_entry_against_invoice from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import get_gl_entries +from erpnext.tests.utils import ERPNextTestSuite -class TestInvoiceDiscounting(IntegrationTestCase): +class TestInvoiceDiscounting(ERPNextTestSuite): def setUp(self): self.ar_credit = create_account( account_name="_Test Accounts Receivable Credit", diff --git a/erpnext/accounts/doctype/item_tax_template/test_item_tax_template.py b/erpnext/accounts/doctype/item_tax_template/test_item_tax_template.py index d5d8701fdc2..07032b79db2 100644 --- a/erpnext/accounts/doctype/item_tax_template/test_item_tax_template.py +++ b/erpnext/accounts/doctype/item_tax_template/test_item_tax_template.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestItemTaxTemplate(IntegrationTestCase): +class TestItemTaxTemplate(ERPNextTestSuite): pass diff --git a/erpnext/accounts/doctype/journal_entry/test_journal_entry.py b/erpnext/accounts/doctype/journal_entry/test_journal_entry.py index 1a048a237bf..36e6a9182ad 100644 --- a/erpnext/accounts/doctype/journal_entry/test_journal_entry.py +++ b/erpnext/accounts/doctype/journal_entry/test_journal_entry.py @@ -2,19 +2,17 @@ # License: GNU General Public License v3. See license.txt import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import flt, nowdate from erpnext.accounts.doctype.account.test_account import get_inventory_account from erpnext.accounts.doctype.journal_entry.journal_entry import StockAccountInvalidTransaction from erpnext.exceptions import InvalidAccountCurrency from erpnext.selling.doctype.customer.test_customer import make_customer, set_credit_limit +from erpnext.tests.utils import ERPNextTestSuite -class TestJournalEntry(IntegrationTestCase): - @IntegrationTestCase.change_settings( - "Accounts Settings", {"unlink_payment_on_cancellation_of_invoice": 1} - ) +class TestJournalEntry(ERPNextTestSuite): + @ERPNextTestSuite.change_settings("Accounts Settings", {"unlink_payment_on_cancellation_of_invoice": 1}) def test_journal_entry_with_against_jv(self): jv_invoice = frappe.copy_doc(self.globalTestRecords["Journal Entry"][2]) base_jv = frappe.copy_doc(self.globalTestRecords["Journal Entry"][0]) diff --git a/erpnext/accounts/doctype/journal_entry_template/test_journal_entry_template.py b/erpnext/accounts/doctype/journal_entry_template/test_journal_entry_template.py index 95a287435ff..946f4a64a43 100644 --- a/erpnext/accounts/doctype/journal_entry_template/test_journal_entry_template.py +++ b/erpnext/accounts/doctype/journal_entry_template/test_journal_entry_template.py @@ -3,8 +3,8 @@ # import frappe import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestJournalEntryTemplate(IntegrationTestCase): +class TestJournalEntryTemplate(ERPNextTestSuite): pass diff --git a/erpnext/accounts/doctype/ledger_health/test_ledger_health.py b/erpnext/accounts/doctype/ledger_health/test_ledger_health.py index 0eec86ccc0f..d94ccb53afe 100644 --- a/erpnext/accounts/doctype/ledger_health/test_ledger_health.py +++ b/erpnext/accounts/doctype/ledger_health/test_ledger_health.py @@ -3,14 +3,14 @@ import frappe from frappe import qb -from frappe.tests import IntegrationTestCase from frappe.utils import nowdate from erpnext.accounts.test.accounts_mixin import AccountsTestMixin from erpnext.accounts.utils import run_ledger_health_checks +from erpnext.tests.utils import ERPNextTestSuite -class TestLedgerHealth(AccountsTestMixin, IntegrationTestCase): +class TestLedgerHealth(AccountsTestMixin, ERPNextTestSuite): def setUp(self): self.create_company() self.create_customer() diff --git a/erpnext/accounts/doctype/ledger_health_monitor/test_ledger_health_monitor.py b/erpnext/accounts/doctype/ledger_health_monitor/test_ledger_health_monitor.py index bc2193f10ce..191a06510b9 100644 --- a/erpnext/accounts/doctype/ledger_health_monitor/test_ledger_health_monitor.py +++ b/erpnext/accounts/doctype/ledger_health_monitor/test_ledger_health_monitor.py @@ -2,8 +2,10 @@ # See license.txt # import frappe -from frappe.tests import IntegrationTestCase -class TestLedgerHealthMonitor(IntegrationTestCase): +from erpnext.tests.utils import ERPNextTestSuite + + +class TestLedgerHealthMonitor(ERPNextTestSuite): pass diff --git a/erpnext/accounts/doctype/ledger_merge/test_ledger_merge.py b/erpnext/accounts/doctype/ledger_merge/test_ledger_merge.py index fd5001f97bc..df45ab646d6 100644 --- a/erpnext/accounts/doctype/ledger_merge/test_ledger_merge.py +++ b/erpnext/accounts/doctype/ledger_merge/test_ledger_merge.py @@ -3,12 +3,12 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from erpnext.accounts.doctype.ledger_merge.ledger_merge import start_merge +from erpnext.tests.utils import ERPNextTestSuite -class TestLedgerMerge(IntegrationTestCase): +class TestLedgerMerge(ERPNextTestSuite): def test_merge_success(self): if not frappe.db.exists("Account", "Indirect Expenses - _TC"): acc = frappe.new_doc("Account") diff --git a/erpnext/accounts/doctype/loyalty_point_entry/test_loyalty_point_entry.py b/erpnext/accounts/doctype/loyalty_point_entry/test_loyalty_point_entry.py index c085e6caf5e..d6abfa08b4f 100644 --- a/erpnext/accounts/doctype/loyalty_point_entry/test_loyalty_point_entry.py +++ b/erpnext/accounts/doctype/loyalty_point_entry/test_loyalty_point_entry.py @@ -3,14 +3,14 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import today from erpnext.accounts.doctype.loyalty_program.test_loyalty_program import create_records from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice +from erpnext.tests.utils import ERPNextTestSuite -class TestLoyaltyPointEntry(IntegrationTestCase): +class TestLoyaltyPointEntry(ERPNextTestSuite): @classmethod def setUpClass(cls): super().setUpClass() diff --git a/erpnext/accounts/doctype/loyalty_program/test_loyalty_program.py b/erpnext/accounts/doctype/loyalty_program/test_loyalty_program.py index 604e95df6b8..970b3180efc 100644 --- a/erpnext/accounts/doctype/loyalty_program/test_loyalty_program.py +++ b/erpnext/accounts/doctype/loyalty_program/test_loyalty_program.py @@ -3,7 +3,6 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import cint, flt, getdate, today from erpnext.accounts.doctype.loyalty_program.loyalty_program import ( @@ -11,9 +10,10 @@ from erpnext.accounts.doctype.loyalty_program.loyalty_program import ( get_loyalty_program_details_with_points, ) from erpnext.accounts.party import get_dashboard_info +from erpnext.tests.utils import ERPNextTestSuite -class TestLoyaltyProgram(IntegrationTestCase): +class TestLoyaltyProgram(ERPNextTestSuite): @classmethod def setUpClass(cls): super().setUpClass() diff --git a/erpnext/accounts/doctype/mode_of_payment/test_mode_of_payment.py b/erpnext/accounts/doctype/mode_of_payment/test_mode_of_payment.py index ee2a594f8f0..2f485f10f81 100644 --- a/erpnext/accounts/doctype/mode_of_payment/test_mode_of_payment.py +++ b/erpnext/accounts/doctype/mode_of_payment/test_mode_of_payment.py @@ -3,10 +3,11 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase + +from erpnext.tests.utils import ERPNextTestSuite -class TestModeofPayment(IntegrationTestCase): +class TestModeofPayment(ERPNextTestSuite): pass diff --git a/erpnext/accounts/doctype/monthly_distribution/test_monthly_distribution.py b/erpnext/accounts/doctype/monthly_distribution/test_monthly_distribution.py index 06c153940a8..30d35527136 100644 --- a/erpnext/accounts/doctype/monthly_distribution/test_monthly_distribution.py +++ b/erpnext/accounts/doctype/monthly_distribution/test_monthly_distribution.py @@ -2,9 +2,8 @@ # See license.txt import unittest -import frappe -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestMonthlyDistribution(IntegrationTestCase): +class TestMonthlyDistribution(ERPNextTestSuite): pass diff --git a/erpnext/accounts/doctype/opening_invoice_creation_tool/test_opening_invoice_creation_tool.py b/erpnext/accounts/doctype/opening_invoice_creation_tool/test_opening_invoice_creation_tool.py index b4f29710f4b..70f91cdab55 100644 --- a/erpnext/accounts/doctype/opening_invoice_creation_tool/test_opening_invoice_creation_tool.py +++ b/erpnext/accounts/doctype/opening_invoice_creation_tool/test_opening_invoice_creation_tool.py @@ -2,7 +2,6 @@ # See license.txt import frappe -from frappe.tests import IntegrationTestCase from erpnext.accounts.doctype.accounting_dimension.test_accounting_dimension import ( create_dimension, @@ -11,9 +10,10 @@ from erpnext.accounts.doctype.accounting_dimension.test_accounting_dimension imp from erpnext.accounts.doctype.opening_invoice_creation_tool.opening_invoice_creation_tool import ( get_temporary_opening_account, ) +from erpnext.tests.utils import ERPNextTestSuite -class TestOpeningInvoiceCreationTool(IntegrationTestCase): +class TestOpeningInvoiceCreationTool(ERPNextTestSuite): @classmethod def setUpClass(cls): if not frappe.db.exists("Company", "_Test Opening Invoice Company"): diff --git a/erpnext/accounts/doctype/party_link/test_party_link.py b/erpnext/accounts/doctype/party_link/test_party_link.py index 1c93c65e3c3..c1f59a2209a 100644 --- a/erpnext/accounts/doctype/party_link/test_party_link.py +++ b/erpnext/accounts/doctype/party_link/test_party_link.py @@ -3,8 +3,8 @@ # import frappe import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestPartyLink(IntegrationTestCase): +class TestPartyLink(ERPNextTestSuite): pass diff --git a/erpnext/accounts/doctype/payment_entry/test_payment_entry.py b/erpnext/accounts/doctype/payment_entry/test_payment_entry.py index 73798aed252..8aaf36192b7 100644 --- a/erpnext/accounts/doctype/payment_entry/test_payment_entry.py +++ b/erpnext/accounts/doctype/payment_entry/test_payment_entry.py @@ -4,7 +4,6 @@ import frappe from frappe import qb -from frappe.tests import IntegrationTestCase from frappe.utils import add_days, flt, nowdate from erpnext.accounts.doctype.account.test_account import create_account @@ -24,9 +23,10 @@ from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import ( ) from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order from erpnext.setup.doctype.employee.test_employee import make_employee +from erpnext.tests.utils import ERPNextTestSuite -class TestPaymentEntry(IntegrationTestCase): +class TestPaymentEntry(ERPNextTestSuite): def tearDown(self): frappe.db.rollback() @@ -425,7 +425,7 @@ class TestPaymentEntry(IntegrationTestCase): self.assertEqual(si.payment_schedule[0].outstanding, 0) self.assertEqual(si.payment_schedule[0].discounted_amount, 50) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Accounts Settings", { "allow_multi_currency_invoices_against_single_party_account": 1, @@ -1156,7 +1156,7 @@ class TestPaymentEntry(IntegrationTestCase): } self.assertDictEqual(ref_details, expected_response) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Accounts Settings", { "unlink_payment_on_cancellation_of_invoice": 1, @@ -1251,7 +1251,7 @@ class TestPaymentEntry(IntegrationTestCase): si3.cancel() si3.delete() - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Accounts Settings", { "unlink_payment_on_cancellation_of_invoice": 1, @@ -1947,7 +1947,7 @@ class TestPaymentEntry(IntegrationTestCase): # 'Is Opening' should always be 'No' for normal advance payments self.assertEqual(gl_with_opening_set, []) - @IntegrationTestCase.change_settings("Accounts Settings", {"delete_linked_ledger_entries": 1}) + @ERPNextTestSuite.change_settings("Accounts Settings", {"delete_linked_ledger_entries": 1}) def test_delete_linked_exchange_gain_loss_journal(self): from erpnext.accounts.doctype.account.test_account import create_account from erpnext.accounts.doctype.opening_invoice_creation_tool.test_opening_invoice_creation_tool import ( diff --git a/erpnext/accounts/doctype/payment_gateway_account/test_payment_gateway_account.py b/erpnext/accounts/doctype/payment_gateway_account/test_payment_gateway_account.py index 4d30780da8c..ad4373edd75 100644 --- a/erpnext/accounts/doctype/payment_gateway_account/test_payment_gateway_account.py +++ b/erpnext/accounts/doctype/payment_gateway_account/test_payment_gateway_account.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestPaymentGatewayAccount(IntegrationTestCase): +class TestPaymentGatewayAccount(ERPNextTestSuite): pass diff --git a/erpnext/accounts/doctype/payment_ledger_entry/test_payment_ledger_entry.py b/erpnext/accounts/doctype/payment_ledger_entry/test_payment_ledger_entry.py index 1de103764a4..12e6e9cd0c8 100644 --- a/erpnext/accounts/doctype/payment_ledger_entry/test_payment_ledger_entry.py +++ b/erpnext/accounts/doctype/payment_ledger_entry/test_payment_ledger_entry.py @@ -3,7 +3,6 @@ import frappe from frappe import qb -from frappe.tests import IntegrationTestCase from frappe.utils import nowdate from erpnext.accounts.doctype.payment_entry.payment_entry import get_payment_entry @@ -11,9 +10,10 @@ from erpnext.accounts.doctype.payment_entry.test_payment_entry import create_pay from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order from erpnext.stock.doctype.item.test_item import create_item +from erpnext.tests.utils import ERPNextTestSuite -class TestPaymentLedgerEntry(IntegrationTestCase): +class TestPaymentLedgerEntry(ERPNextTestSuite): def setUp(self): self.ple = qb.DocType("Payment Ledger Entry") self.create_company() @@ -445,7 +445,7 @@ class TestPaymentLedgerEntry(IntegrationTestCase): self.assertEqual(pl_entries_for_crnote[0], expected_values[0]) self.assertEqual(pl_entries_for_crnote[1], expected_values[1]) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Accounts Settings", {"unlink_payment_on_cancellation_of_invoice": 1, "delete_linked_ledger_entries": 1}, ) @@ -474,7 +474,7 @@ class TestPaymentLedgerEntry(IntegrationTestCase): si.delete() self.assertRaises(frappe.DoesNotExistError, frappe.get_doc, si.doctype, si.name) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Accounts Settings", {"unlink_payment_on_cancellation_of_invoice": 1, "delete_linked_ledger_entries": 1}, ) @@ -507,7 +507,7 @@ class TestPaymentLedgerEntry(IntegrationTestCase): si.delete() self.assertRaises(frappe.DoesNotExistError, frappe.get_doc, si.doctype, si.name) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Accounts Settings", { "unlink_payment_on_cancellation_of_invoice": 1, diff --git a/erpnext/accounts/doctype/payment_order/test_payment_order.py b/erpnext/accounts/doctype/payment_order/test_payment_order.py index f12491fdf15..71ad044ed57 100644 --- a/erpnext/accounts/doctype/payment_order/test_payment_order.py +++ b/erpnext/accounts/doctype/payment_order/test_payment_order.py @@ -3,7 +3,6 @@ import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import getdate from erpnext.accounts.doctype.bank_transaction.test_bank_transaction import ( @@ -15,9 +14,10 @@ from erpnext.accounts.doctype.payment_entry.payment_entry import ( make_payment_order, ) from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import make_purchase_invoice +from erpnext.tests.utils import ERPNextTestSuite -class TestPaymentOrder(IntegrationTestCase): +class TestPaymentOrder(ERPNextTestSuite): def setUp(self): # generate and use a uniq hash identifier for 'Bank Account' and it's linked GL 'Account' to avoid validation error uniq_identifier = frappe.generate_hash(length=10) diff --git a/erpnext/accounts/doctype/payment_reconciliation/test_payment_reconciliation.py b/erpnext/accounts/doctype/payment_reconciliation/test_payment_reconciliation.py index 031bd801cb2..1cd39c36fbe 100644 --- a/erpnext/accounts/doctype/payment_reconciliation/test_payment_reconciliation.py +++ b/erpnext/accounts/doctype/payment_reconciliation/test_payment_reconciliation.py @@ -4,7 +4,6 @@ import frappe from frappe import qb -from frappe.tests import IntegrationTestCase from frappe.utils import add_days, add_years, flt, getdate, nowdate, today from frappe.utils.data import getdate as convert_to_date @@ -17,9 +16,10 @@ from erpnext.accounts.party import get_party_account from erpnext.accounts.utils import get_fiscal_year from erpnext.buying.doctype.purchase_order.test_purchase_order import create_purchase_order from erpnext.stock.doctype.item.test_item import create_item +from erpnext.tests.utils import ERPNextTestSuite -class TestPaymentReconciliation(IntegrationTestCase): +class TestPaymentReconciliation(ERPNextTestSuite): def setUp(self): self.create_company() self.create_item() @@ -1233,7 +1233,7 @@ class TestPaymentReconciliation(IntegrationTestCase): payment_vouchers = [x.get("reference_name") for x in pr.get("payments")] self.assertCountEqual(payment_vouchers, [je2.name, pe2.name]) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Accounts Settings", { "allow_multi_currency_invoices_against_single_party_account": 1, diff --git a/erpnext/accounts/doctype/payment_request/test_payment_request.py b/erpnext/accounts/doctype/payment_request/test_payment_request.py index 7ae04c27433..5035d2a2042 100644 --- a/erpnext/accounts/doctype/payment_request/test_payment_request.py +++ b/erpnext/accounts/doctype/payment_request/test_payment_request.py @@ -7,7 +7,6 @@ import unittest from unittest.mock import patch import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import add_days, nowdate from erpnext.accounts.doctype.payment_entry.payment_entry import get_payment_entry @@ -18,6 +17,7 @@ from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sal from erpnext.buying.doctype.purchase_order.test_purchase_order import create_purchase_order from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order from erpnext.setup.utils import get_exchange_rate +from erpnext.tests.utils import ERPNextTestSuite PAYMENT_URL = "https://example.com/payment" @@ -62,7 +62,7 @@ payment_method = [ ] -class TestPaymentRequest(IntegrationTestCase): +class TestPaymentRequest(ERPNextTestSuite): def setUp(self): for payment_gateway in payment_gateways: if not frappe.db.get_value("Payment Gateway", payment_gateway["gateway"], "name"): @@ -502,7 +502,7 @@ class TestPaymentRequest(IntegrationTestCase): return_doc=1, ) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Accounts Settings", {"allow_multi_currency_invoices_against_single_party_account": 1} ) def test_multiple_payment_if_partially_paid_for_multi_currency(self): @@ -620,7 +620,7 @@ class TestPaymentRequest(IntegrationTestCase): self.assertEqual(pr.outstanding_amount, 0) self.assertEqual(pr.grand_total, 20000) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Accounts Settings", {"allow_multi_currency_invoices_against_single_party_account": 1} ) def test_single_payment_with_payment_term_for_multi_currency(self): diff --git a/erpnext/accounts/doctype/payment_term/test_payment_term.py b/erpnext/accounts/doctype/payment_term/test_payment_term.py index 08f51cfb4e9..62129971c16 100644 --- a/erpnext/accounts/doctype/payment_term/test_payment_term.py +++ b/erpnext/accounts/doctype/payment_term/test_payment_term.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestPaymentTerm(IntegrationTestCase): +class TestPaymentTerm(ERPNextTestSuite): pass diff --git a/erpnext/accounts/doctype/payment_terms_template/test_payment_terms_template.py b/erpnext/accounts/doctype/payment_terms_template/test_payment_terms_template.py index fb0020f78ac..de8452d93e1 100644 --- a/erpnext/accounts/doctype/payment_terms_template/test_payment_terms_template.py +++ b/erpnext/accounts/doctype/payment_terms_template/test_payment_terms_template.py @@ -3,10 +3,11 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase + +from erpnext.tests.utils import ERPNextTestSuite -class TestPaymentTermsTemplate(IntegrationTestCase): +class TestPaymentTermsTemplate(ERPNextTestSuite): def tearDown(self): frappe.delete_doc("Payment Terms Template", "_Test Payment Terms Template For Test", force=1) diff --git a/erpnext/accounts/doctype/period_closing_voucher/test_period_closing_voucher.py b/erpnext/accounts/doctype/period_closing_voucher/test_period_closing_voucher.py index 67191f99993..1fcff98a467 100644 --- a/erpnext/accounts/doctype/period_closing_voucher/test_period_closing_voucher.py +++ b/erpnext/accounts/doctype/period_closing_voucher/test_period_closing_voucher.py @@ -3,16 +3,16 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import today from erpnext.accounts.doctype.finance_book.test_finance_book import create_finance_book from erpnext.accounts.doctype.journal_entry.test_journal_entry import make_journal_entry from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice from erpnext.accounts.utils import get_fiscal_year +from erpnext.tests.utils import ERPNextTestSuite -class TestPeriodClosingVoucher(IntegrationTestCase): +class TestPeriodClosingVoucher(ERPNextTestSuite): def setUp(self): super().setUp() frappe.db.set_single_value("Accounts Settings", "use_legacy_controller_for_pcv", 1) diff --git a/erpnext/accounts/doctype/pos_closing_entry/test_pos_closing_entry.py b/erpnext/accounts/doctype/pos_closing_entry/test_pos_closing_entry.py index 148a5a83030..6041d4fcac1 100644 --- a/erpnext/accounts/doctype/pos_closing_entry/test_pos_closing_entry.py +++ b/erpnext/accounts/doctype/pos_closing_entry/test_pos_closing_entry.py @@ -3,7 +3,6 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from erpnext.accounts.doctype.accounting_dimension.test_accounting_dimension import ( create_dimension, @@ -22,9 +21,10 @@ from erpnext.stock.doctype.serial_and_batch_bundle.test_serial_and_batch_bundle get_batch_from_bundle, ) from erpnext.stock.doctype.stock_entry.test_stock_entry import make_stock_entry +from erpnext.tests.utils import ERPNextTestSuite -class TestPOSClosingEntry(IntegrationTestCase): +class TestPOSClosingEntry(ERPNextTestSuite): @classmethod def setUpClass(cls): frappe.db.sql("delete from `tabPOS Opening Entry`") @@ -302,7 +302,7 @@ class TestPOSClosingEntry(IntegrationTestCase): batch_qty_with_pos = get_batch_qty(batch_no, "_Test Warehouse - _TC", item_code) self.assertEqual(batch_qty_with_pos, 10.0) - @IntegrationTestCase.change_settings("POS Settings", {"invoice_type": "Sales Invoice"}) + @ERPNextTestSuite.change_settings("POS Settings", {"invoice_type": "Sales Invoice"}) def test_closing_entries_with_sales_invoice(self): test_user, pos_profile = init_user_and_profile() opening_entry = create_opening_entry(pos_profile, test_user.name) diff --git a/erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py b/erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py index 1a94e1c9990..d321ac3ae42 100644 --- a/erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py +++ b/erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py @@ -5,7 +5,6 @@ import unittest import frappe from frappe import _ -from frappe.tests import IntegrationTestCase from erpnext.accounts.doctype.mode_of_payment.test_mode_of_payment import ( set_default_account_for_mode_of_payment, @@ -22,9 +21,10 @@ from erpnext.stock.doctype.serial_and_batch_bundle.test_serial_and_batch_bundle make_serial_batch_bundle, ) from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry +from erpnext.tests.utils import ERPNextTestSuite -class TestPOSInvoice(IntegrationTestCase): +class TestPOSInvoice(ERPNextTestSuite): @classmethod def setUpClass(cls): super().setUpClass() 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 5403b10476c..c3381eec4e5 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 @@ -3,7 +3,6 @@ import json import frappe -from frappe.tests import IntegrationTestCase from erpnext.accounts.doctype.mode_of_payment.test_mode_of_payment import ( set_default_account_for_mode_of_payment, @@ -19,9 +18,10 @@ from erpnext.stock.doctype.serial_and_batch_bundle.test_serial_and_batch_bundle get_serial_nos_from_bundle, ) from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry +from erpnext.tests.utils import ERPNextTestSuite -class TestPOSInvoiceMergeLog(IntegrationTestCase): +class TestPOSInvoiceMergeLog(ERPNextTestSuite): @classmethod def setUpClass(cls): super().setUpClass() @@ -315,7 +315,7 @@ class TestPOSInvoiceMergeLog(IntegrationTestCase): self.assertNotEqual(consolidated_invoice.outstanding_amount, 800) self.assertEqual(consolidated_invoice.status, "Paid") - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "System Settings", {"number_format": "#,###.###", "currency_precision": 3, "float_precision": 3} ) def test_consolidation_round_off_error_3(self): diff --git a/erpnext/accounts/doctype/pos_opening_entry/test_pos_opening_entry.py b/erpnext/accounts/doctype/pos_opening_entry/test_pos_opening_entry.py index 2b23f94932f..5cca1ad72b8 100644 --- a/erpnext/accounts/doctype/pos_opening_entry/test_pos_opening_entry.py +++ b/erpnext/accounts/doctype/pos_opening_entry/test_pos_opening_entry.py @@ -4,21 +4,23 @@ import unittest import frappe from frappe.core.doctype.user_permission.test_user_permission import create_user -from frappe.tests import IntegrationTestCase from erpnext.accounts.doctype.pos_invoice.test_pos_invoice import create_pos_invoice from erpnext.accounts.doctype.pos_profile.test_pos_profile import make_pos_profile from erpnext.stock.doctype.stock_entry.test_stock_entry import make_stock_entry +from erpnext.tests.utils import ERPNextTestSuite -class TestPOSOpeningEntry(IntegrationTestCase): +class TestPOSOpeningEntry(ERPNextTestSuite): @classmethod def setUpClass(cls): + super().setUpClass() frappe.db.sql("delete from `tabPOS Opening Entry`") cls.enterClassContext(cls.change_settings("POS Settings", {"invoice_type": "POS Invoice"})) @classmethod def tearDownClass(cls): + super().tearDownClass() frappe.db.sql("delete from `tabPOS Opening Entry`") def setUp(self): diff --git a/erpnext/accounts/doctype/pos_profile/test_pos_profile.py b/erpnext/accounts/doctype/pos_profile/test_pos_profile.py index a52933487f4..1e874579a98 100644 --- a/erpnext/accounts/doctype/pos_profile/test_pos_profile.py +++ b/erpnext/accounts/doctype/pos_profile/test_pos_profile.py @@ -3,16 +3,16 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import cint from erpnext.accounts.doctype.pos_profile.pos_profile import ( get_child_nodes, ) from erpnext.stock.get_item_details import get_pos_profile +from erpnext.tests.utils import ERPNextTestSuite -class TestPOSProfile(IntegrationTestCase): +class TestPOSProfile(ERPNextTestSuite): def test_pos_profile(self): make_pos_profile() diff --git a/erpnext/accounts/doctype/pos_profile_user/test_pos_profile_user.py b/erpnext/accounts/doctype/pos_profile_user/test_pos_profile_user.py index b9747ff5799..2e3b68eeac5 100644 --- a/erpnext/accounts/doctype/pos_profile_user/test_pos_profile_user.py +++ b/erpnext/accounts/doctype/pos_profile_user/test_pos_profile_user.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestPOSProfileUser(IntegrationTestCase): +class TestPOSProfileUser(ERPNextTestSuite): pass diff --git a/erpnext/accounts/doctype/pos_settings/test_pos_settings.py b/erpnext/accounts/doctype/pos_settings/test_pos_settings.py index 1ae75140714..9335efbed07 100644 --- a/erpnext/accounts/doctype/pos_settings/test_pos_settings.py +++ b/erpnext/accounts/doctype/pos_settings/test_pos_settings.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestPOSSettings(IntegrationTestCase): +class TestPOSSettings(ERPNextTestSuite): pass diff --git a/erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py b/erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py index f4c9709e3f3..6312a2e4fb6 100644 --- a/erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py +++ b/erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py @@ -5,7 +5,6 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import make_purchase_invoice from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice @@ -13,9 +12,10 @@ from erpnext.controllers.sales_and_purchase_return import make_return_doc from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order from erpnext.stock.doctype.item.test_item import make_item from erpnext.stock.get_item_details import get_item_details +from erpnext.tests.utils import ERPNextTestSuite -class TestPricingRule(IntegrationTestCase): +class TestPricingRule(ERPNextTestSuite): def setUp(self): delete_existing_pricing_rules() setup_pricing_rule_data() diff --git a/erpnext/accounts/doctype/process_deferred_accounting/test_process_deferred_accounting.py b/erpnext/accounts/doctype/process_deferred_accounting/test_process_deferred_accounting.py index 8d35b7fcf85..eb69562e0d4 100644 --- a/erpnext/accounts/doctype/process_deferred_accounting/test_process_deferred_accounting.py +++ b/erpnext/accounts/doctype/process_deferred_accounting/test_process_deferred_accounting.py @@ -3,7 +3,6 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from erpnext.accounts.doctype.account.test_account import create_account from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import ( @@ -11,9 +10,10 @@ from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import ( create_sales_invoice, ) from erpnext.stock.doctype.item.test_item import create_item +from erpnext.tests.utils import ERPNextTestSuite -class TestProcessDeferredAccounting(IntegrationTestCase): +class TestProcessDeferredAccounting(ERPNextTestSuite): def test_creation_of_ledger_entry_on_submit(self): """test creation of gl entries on submission of document""" change_acc_settings(acc_frozen_till_date="2023-05-31", book_deferred_entries_based_on="Months") diff --git a/erpnext/accounts/doctype/process_payment_reconciliation/test_process_payment_reconciliation.py b/erpnext/accounts/doctype/process_payment_reconciliation/test_process_payment_reconciliation.py index d54ff6f902e..eff49ecadc5 100644 --- a/erpnext/accounts/doctype/process_payment_reconciliation/test_process_payment_reconciliation.py +++ b/erpnext/accounts/doctype/process_payment_reconciliation/test_process_payment_reconciliation.py @@ -2,8 +2,10 @@ # See license.txt # import frappe -from frappe.tests import IntegrationTestCase -class TestProcessPaymentReconciliation(IntegrationTestCase): +from erpnext.tests.utils import ERPNextTestSuite + + +class TestProcessPaymentReconciliation(ERPNextTestSuite): pass diff --git a/erpnext/accounts/doctype/process_payment_reconciliation_log/test_process_payment_reconciliation_log.py b/erpnext/accounts/doctype/process_payment_reconciliation_log/test_process_payment_reconciliation_log.py index 66a4dca21e1..26c4b5a4a1c 100644 --- a/erpnext/accounts/doctype/process_payment_reconciliation_log/test_process_payment_reconciliation_log.py +++ b/erpnext/accounts/doctype/process_payment_reconciliation_log/test_process_payment_reconciliation_log.py @@ -2,8 +2,10 @@ # See license.txt # import frappe -from frappe.tests import IntegrationTestCase -class TestProcessPaymentReconciliationLog(IntegrationTestCase): +from erpnext.tests.utils import ERPNextTestSuite + + +class TestProcessPaymentReconciliationLog(ERPNextTestSuite): pass 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 2d599fee1af..44f5bf9c3ff 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 @@ -3,7 +3,6 @@ import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import add_days, getdate, today from erpnext.accounts.doctype.process_statement_of_accounts.process_statement_of_accounts import ( @@ -12,9 +11,10 @@ from erpnext.accounts.doctype.process_statement_of_accounts.process_statement_of ) from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice from erpnext.accounts.test.accounts_mixin import AccountsTestMixin +from erpnext.tests.utils import ERPNextTestSuite -class TestProcessStatementOfAccounts(AccountsTestMixin, IntegrationTestCase): +class TestProcessStatementOfAccounts(AccountsTestMixin, ERPNextTestSuite): @classmethod def setUpClass(cls): super().setUpClass() diff --git a/erpnext/accounts/doctype/process_subscription/test_process_subscription.py b/erpnext/accounts/doctype/process_subscription/test_process_subscription.py index 5ec80641192..8c7604b8f5c 100644 --- a/erpnext/accounts/doctype/process_subscription/test_process_subscription.py +++ b/erpnext/accounts/doctype/process_subscription/test_process_subscription.py @@ -2,8 +2,10 @@ # See license.txt # import frappe -from frappe.tests import IntegrationTestCase -class TestProcessSubscription(IntegrationTestCase): +from erpnext.tests.utils import ERPNextTestSuite + + +class TestProcessSubscription(ERPNextTestSuite): pass diff --git a/erpnext/accounts/doctype/promotional_scheme/test_promotional_scheme.py b/erpnext/accounts/doctype/promotional_scheme/test_promotional_scheme.py index 413ce1af792..cebdaa4fca8 100644 --- a/erpnext/accounts/doctype/promotional_scheme/test_promotional_scheme.py +++ b/erpnext/accounts/doctype/promotional_scheme/test_promotional_scheme.py @@ -3,13 +3,13 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from erpnext.accounts.doctype.promotional_scheme.promotional_scheme import TransactionExists from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order +from erpnext.tests.utils import ERPNextTestSuite -class TestPromotionalScheme(IntegrationTestCase): +class TestPromotionalScheme(ERPNextTestSuite): def setUp(self): if frappe.db.exists("Promotional Scheme", "_Test Scheme"): frappe.delete_doc("Promotional Scheme", "_Test Scheme") diff --git a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py index b28b1a2c4a8..4260bfbb5d8 100644 --- a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py @@ -3,7 +3,6 @@ import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import add_days, cint, flt, getdate, nowdate, today import erpnext @@ -37,9 +36,10 @@ from erpnext.stock.doctype.serial_and_batch_bundle.test_serial_and_batch_bundle ) from erpnext.stock.doctype.stock_entry.test_stock_entry import get_qty_after_transaction from erpnext.stock.tests.test_utils import StockTestMixin +from erpnext.tests.utils import ERPNextTestSuite -class TestPurchaseInvoice(IntegrationTestCase, StockTestMixin): +class TestPurchaseInvoice(ERPNextTestSuite, StockTestMixin): @classmethod def setUpClass(cls): super().setUpClass() @@ -506,9 +506,7 @@ class TestPurchaseInvoice(IntegrationTestCase, StockTestMixin): self.assertEqual(tax.tax_amount, expected_values[i][1]) self.assertEqual(tax.total, expected_values[i][2]) - @IntegrationTestCase.change_settings( - "Accounts Settings", {"unlink_payment_on_cancellation_of_invoice": 1} - ) + @ERPNextTestSuite.change_settings("Accounts Settings", {"unlink_payment_on_cancellation_of_invoice": 1}) def test_purchase_invoice_with_advance(self): jv = frappe.copy_doc(self.globalTestRecords["Journal Entry"][1]) jv.insert() @@ -559,9 +557,7 @@ class TestPurchaseInvoice(IntegrationTestCase, StockTestMixin): ) ) - @IntegrationTestCase.change_settings( - "Accounts Settings", {"unlink_payment_on_cancellation_of_invoice": 1} - ) + @ERPNextTestSuite.change_settings("Accounts Settings", {"unlink_payment_on_cancellation_of_invoice": 1}) def test_invoice_with_advance_and_multi_payment_terms(self): jv = frappe.copy_doc(self.globalTestRecords["Journal Entry"][1]) jv.insert() @@ -1286,9 +1282,7 @@ class TestPurchaseInvoice(IntegrationTestCase, StockTestMixin): acc_settings.submit_journal_entriessubmit_journal_entries = 0 acc_settings.save() - @IntegrationTestCase.change_settings( - "Accounts Settings", {"unlink_payment_on_cancellation_of_invoice": 1} - ) + @ERPNextTestSuite.change_settings("Accounts Settings", {"unlink_payment_on_cancellation_of_invoice": 1}) def test_gain_loss_with_advance_entry(self): unlink_enabled = frappe.db.get_single_value( "Accounts Settings", "unlink_payment_on_cancellation_of_invoice" @@ -1489,9 +1483,7 @@ class TestPurchaseInvoice(IntegrationTestCase, StockTestMixin): ) frappe.db.set_value("Company", "_Test Company", "exchange_gain_loss_account", original_account) - @IntegrationTestCase.change_settings( - "Accounts Settings", {"unlink_payment_on_cancellation_of_invoice": 1} - ) + @ERPNextTestSuite.change_settings("Accounts Settings", {"unlink_payment_on_cancellation_of_invoice": 1}) def test_purchase_invoice_advance_taxes(self): from erpnext.accounts.doctype.payment_entry.payment_entry import get_payment_entry @@ -2157,7 +2149,7 @@ class TestPurchaseInvoice(IntegrationTestCase, StockTestMixin): rate = flt(sle.stock_value_difference) / flt(sle.actual_qty) self.assertAlmostEqual(rate, 500) - @IntegrationTestCase.change_settings("Accounts Settings", {"automatically_fetch_payment_terms": 1}) + @ERPNextTestSuite.change_settings("Accounts Settings", {"automatically_fetch_payment_terms": 1}) def test_payment_allocation_for_payment_terms(self): from erpnext.buying.doctype.purchase_order.test_purchase_order import ( create_pr_against_po, @@ -2292,7 +2284,7 @@ class TestPurchaseInvoice(IntegrationTestCase, StockTestMixin): pi.delete() - @IntegrationTestCase.change_settings("Buying Settings", {"supplier_group": None}) + @ERPNextTestSuite.change_settings("Buying Settings", {"supplier_group": None}) def test_purchase_invoice_without_supplier_group(self): # Create a Supplier test_supplier_name = "_Test Supplier Without Supplier Group" @@ -2639,7 +2631,7 @@ class TestPurchaseInvoice(IntegrationTestCase, StockTestMixin): frappe.db.set_single_value("Buying Settings", "maintain_same_rate", 1) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Buying Settings", {"maintain_same_rate": 0, "set_landed_cost_based_on_purchase_invoice_rate": 1} ) def test_pr_status_rate_adjusted_from_pi(self): diff --git a/erpnext/accounts/doctype/purchase_taxes_and_charges_template/test_purchase_taxes_and_charges_template.py b/erpnext/accounts/doctype/purchase_taxes_and_charges_template/test_purchase_taxes_and_charges_template.py index 80ce28c4ffd..5dbd05a17f6 100644 --- a/erpnext/accounts/doctype/purchase_taxes_and_charges_template/test_purchase_taxes_and_charges_template.py +++ b/erpnext/accounts/doctype/purchase_taxes_and_charges_template/test_purchase_taxes_and_charges_template.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestPurchaseTaxesandChargesTemplate(IntegrationTestCase): +class TestPurchaseTaxesandChargesTemplate(ERPNextTestSuite): pass 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 cde007d14f6..6e0712972da 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 @@ -4,7 +4,6 @@ import frappe from frappe import qb from frappe.query_builder.functions import Sum -from frappe.tests import IntegrationTestCase from frappe.utils import add_days, nowdate, today from erpnext.accounts.doctype.payment_entry.payment_entry import get_payment_entry @@ -14,9 +13,10 @@ from erpnext.accounts.test.accounts_mixin import AccountsTestMixin from erpnext.accounts.utils import get_fiscal_year from erpnext.stock.doctype.item.test_item import make_item from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import get_gl_entries, make_purchase_receipt +from erpnext.tests.utils import ERPNextTestSuite -class TestRepostAccountingLedger(AccountsTestMixin, IntegrationTestCase): +class TestRepostAccountingLedger(AccountsTestMixin, ERPNextTestSuite): @classmethod def setUpClass(cls): super().setUpClass() @@ -121,7 +121,7 @@ class TestRepostAccountingLedger(AccountsTestMixin, IntegrationTestCase): ral.append("vouchers", {"voucher_type": si.doctype, "voucher_no": si.name}) self.assertRaises(frappe.ValidationError, ral.save) - @IntegrationTestCase.change_settings("Accounts Settings", {"delete_linked_ledger_entries": 1}) + @ERPNextTestSuite.change_settings("Accounts Settings", {"delete_linked_ledger_entries": 1}) def test_04_pcv_validation(self): # Clear old GL entries so PCV can be submitted. gl = frappe.qb.DocType("GL Entry") diff --git a/erpnext/accounts/doctype/repost_accounting_ledger_settings/test_repost_accounting_ledger_settings.py b/erpnext/accounts/doctype/repost_accounting_ledger_settings/test_repost_accounting_ledger_settings.py index 2dd4c50ba7e..6a8698e96af 100644 --- a/erpnext/accounts/doctype/repost_accounting_ledger_settings/test_repost_accounting_ledger_settings.py +++ b/erpnext/accounts/doctype/repost_accounting_ledger_settings/test_repost_accounting_ledger_settings.py @@ -2,8 +2,10 @@ # See license.txt # import frappe -from frappe.tests import IntegrationTestCase -class TestRepostAccountingLedgerSettings(IntegrationTestCase): +from erpnext.tests.utils import ERPNextTestSuite + + +class TestRepostAccountingLedgerSettings(ERPNextTestSuite): pass diff --git a/erpnext/accounts/doctype/repost_payment_ledger/test_repost_payment_ledger.py b/erpnext/accounts/doctype/repost_payment_ledger/test_repost_payment_ledger.py index a09ba71e27c..8c2b8946121 100644 --- a/erpnext/accounts/doctype/repost_payment_ledger/test_repost_payment_ledger.py +++ b/erpnext/accounts/doctype/repost_payment_ledger/test_repost_payment_ledger.py @@ -2,8 +2,10 @@ # See license.txt # import frappe -from frappe.tests import IntegrationTestCase -class TestRepostPaymentLedger(IntegrationTestCase): +from erpnext.tests.utils import ERPNextTestSuite + + +class TestRepostPaymentLedger(ERPNextTestSuite): pass diff --git a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py index 732ada84886..4c9c5f72e2e 100644 --- a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py @@ -7,7 +7,6 @@ import json import frappe from frappe import qb from frappe.model.dynamic_links import get_dynamic_link_map -from frappe.tests import IntegrationTestCase, change_settings from frappe.utils import add_days, cint, flt, format_date, getdate, nowdate, today import erpnext @@ -66,7 +65,7 @@ class TestSalesInvoice(ERPNextTestSuite): for company in frappe.get_all("Company", pluck="name"): frappe.db.set_value("Company", company, "accounts_frozen_till_date", None) - @change_settings( + @ERPNextTestSuite.change_settings( "Accounts Settings", {"maintain_same_internal_transaction_rate": 1, "maintain_same_rate_action": "Stop"}, ) @@ -229,9 +228,7 @@ class TestSalesInvoice(ERPNextTestSuite): self.assertRaises(frappe.LinkExistsError, si.cancel) unlink_payment_on_cancel_of_invoice() - @IntegrationTestCase.change_settings( - "Accounts Settings", {"unlink_payment_on_cancellation_of_invoice": 1} - ) + @ERPNextTestSuite.change_settings("Accounts Settings", {"unlink_payment_on_cancellation_of_invoice": 1}) def test_payment_entry_unlink_against_standalone_credit_note(self): from erpnext.accounts.doctype.payment_entry.test_payment_entry import get_payment_entry @@ -844,7 +841,7 @@ class TestSalesInvoice(ERPNextTestSuite): w = self.make() self.assertEqual(w.outstanding_amount, w.base_rounded_total) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Accounts Settings", {"add_taxes_from_item_tax_template": 0, "add_taxes_from_taxes_and_charges_template": 0}, ) @@ -1401,9 +1398,7 @@ class TestSalesInvoice(ERPNextTestSuite): dn.submit() return dn - @IntegrationTestCase.change_settings( - "Accounts Settings", {"unlink_payment_on_cancellation_of_invoice": 1} - ) + @ERPNextTestSuite.change_settings("Accounts Settings", {"unlink_payment_on_cancellation_of_invoice": 1}) def test_sales_invoice_with_advance(self): jv = frappe.copy_doc(self.globalTestRecords["Journal Entry"][0]) jv.insert() @@ -2484,7 +2479,7 @@ class TestSalesInvoice(ERPNextTestSuite): for gle in gl_entries: self.assertEqual(expected_values[gle.account]["cost_center"], gle.cost_center) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Accounts Settings", {"book_deferred_entries_based_on": "Days", "book_deferred_entries_via_journal_entry": 0}, ) @@ -2540,7 +2535,7 @@ class TestSalesInvoice(ERPNextTestSuite): self.assertRaises(frappe.ValidationError, si.save) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Accounts Settings", {"book_deferred_entries_based_on": "Months", "book_deferred_entries_via_journal_entry": 0}, ) @@ -3005,7 +3000,7 @@ class TestSalesInvoice(ERPNextTestSuite): si.submit() - @IntegrationTestCase.change_settings("Selling Settings", {"enable_discount_accounting": 1}) + @ERPNextTestSuite.change_settings("Selling Settings", {"enable_discount_accounting": 1}) def test_sales_invoice_with_discount_accounting_enabled(self): discount_account = create_account( account_name="Discount Account", @@ -3022,7 +3017,7 @@ class TestSalesInvoice(ERPNextTestSuite): check_gl_entries(self, si.name, expected_gle, add_days(nowdate(), -1)) - @IntegrationTestCase.change_settings("Selling Settings", {"enable_discount_accounting": 1}) + @ERPNextTestSuite.change_settings("Selling Settings", {"enable_discount_accounting": 1}) def test_additional_discount_for_sales_invoice_with_discount_accounting_enabled(self): from erpnext.accounts.doctype.repost_accounting_ledger.test_repost_accounting_ledger import ( update_repost_settings, @@ -3449,6 +3444,7 @@ class TestSalesInvoice(ERPNextTestSuite): si.commission_rate = commission_rate self.assertRaises(frappe.ValidationError, si.save) + @ERPNextTestSuite.change_settings("Accounts Settings", {"acc_frozen_upto": add_days(getdate(), 1)}) def test_sales_invoice_submission_post_account_freezing_date(self): frappe.db.set_value("Company", "_Test Company", "accounts_frozen_till_date", add_days(getdate(), 1)) si = create_sales_invoice(do_not_save=True) @@ -3460,7 +3456,7 @@ class TestSalesInvoice(ERPNextTestSuite): si.submit() frappe.db.set_value("Company", "_Test Company", "accounts_frozen_till_date", None) - @IntegrationTestCase.change_settings("Accounts Settings", {"over_billing_allowance": 0}) + @ERPNextTestSuite.change_settings("Accounts Settings", {"over_billing_allowance": 0}) def test_over_billing_case_against_delivery_note(self): """ Test a case where duplicating the item with qty = 1 in the invoice @@ -3486,7 +3482,7 @@ class TestSalesInvoice(ERPNextTestSuite): self.assertTrue("cannot overbill" in str(err.exception).lower()) dn.cancel() - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Accounts Settings", { "book_deferred_entries_via_journal_entry": 1, @@ -3604,9 +3600,7 @@ class TestSalesInvoice(ERPNextTestSuite): account.disabled = 0 account.save() - @IntegrationTestCase.change_settings( - "Accounts Settings", {"unlink_payment_on_cancellation_of_invoice": 1} - ) + @ERPNextTestSuite.change_settings("Accounts Settings", {"unlink_payment_on_cancellation_of_invoice": 1}) def test_gain_loss_with_advance_entry(self): from erpnext.accounts.doctype.journal_entry.test_journal_entry import make_journal_entry @@ -3769,7 +3763,7 @@ class TestSalesInvoice(ERPNextTestSuite): set_advance_flag(company="_Test Company", flag=0, default_account="") - @IntegrationTestCase.change_settings("Selling Settings", {"customer_group": None, "territory": None}) + @ERPNextTestSuite.change_settings("Selling Settings", {"customer_group": None, "territory": None}) def test_sales_invoice_without_customer_group_and_territory(self): # create a customer if not frappe.db.exists("Customer", "_Test Simple Customer"): @@ -3787,7 +3781,7 @@ class TestSalesInvoice(ERPNextTestSuite): self.assertEqual(si.customer_group, None) self.assertEqual(si.territory, None) - @IntegrationTestCase.change_settings("Selling Settings", {"allow_negative_rates_for_items": 0}) + @ERPNextTestSuite.change_settings("Selling Settings", {"allow_negative_rates_for_items": 0}) def test_sales_return_negative_rate(self): si = create_sales_invoice(is_return=1, qty=-2, rate=-10, do_not_save=True) self.assertRaises(frappe.ValidationError, si.save) @@ -4201,7 +4195,7 @@ class TestSalesInvoice(ERPNextTestSuite): self.assertEqual(len(actual), 4) self.assertEqual(expected, actual) - @IntegrationTestCase.change_settings("Accounts Settings", {"enable_common_party_accounting": True}) + @ERPNextTestSuite.change_settings("Accounts Settings", {"enable_common_party_accounting": True}) def test_common_party_with_foreign_currency_jv(self): from erpnext.accounts.doctype.account.test_account import create_account from erpnext.accounts.doctype.opening_invoice_creation_tool.test_opening_invoice_creation_tool import ( @@ -4283,7 +4277,7 @@ class TestSalesInvoice(ERPNextTestSuite): self.assertTrue(jv) self.assertEqual(jv[0], si.grand_total) - @IntegrationTestCase.change_settings("Accounts Settings", {"enable_common_party_accounting": True}) + @ERPNextTestSuite.change_settings("Accounts Settings", {"enable_common_party_accounting": True}) def test_common_party_with_different_currency_in_debtor_and_creditor(self): from erpnext.accounts.doctype.account.test_account import create_account from erpnext.accounts.doctype.opening_invoice_creation_tool.test_opening_invoice_creation_tool import ( @@ -4745,7 +4739,7 @@ class TestSalesInvoice(ERPNextTestSuite): doc.db_set("do_not_use_batchwise_valuation", original_value) - @change_settings("Selling Settings", {"set_zero_rate_for_expired_batch": True}) + @ERPNextTestSuite.change_settings("Selling Settings", {"set_zero_rate_for_expired_batch": True}) def test_zero_valuation_for_standalone_credit_note_with_expired_batch(self): item_code = "_Test Item for Expiry Batch Zero Valuation" make_item_for_si( diff --git a/erpnext/accounts/doctype/sales_taxes_and_charges_template/test_sales_taxes_and_charges_template.py b/erpnext/accounts/doctype/sales_taxes_and_charges_template/test_sales_taxes_and_charges_template.py index 1684ca82cbd..6c9c1d8c206 100644 --- a/erpnext/accounts/doctype/sales_taxes_and_charges_template/test_sales_taxes_and_charges_template.py +++ b/erpnext/accounts/doctype/sales_taxes_and_charges_template/test_sales_taxes_and_charges_template.py @@ -2,9 +2,8 @@ # See license.txt import unittest -import frappe -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestSalesTaxesandChargesTemplate(IntegrationTestCase): +class TestSalesTaxesandChargesTemplate(ERPNextTestSuite): pass diff --git a/erpnext/accounts/doctype/share_transfer/test_share_transfer.py b/erpnext/accounts/doctype/share_transfer/test_share_transfer.py index 3b9e34cc03c..a227a9f3059 100644 --- a/erpnext/accounts/doctype/share_transfer/test_share_transfer.py +++ b/erpnext/accounts/doctype/share_transfer/test_share_transfer.py @@ -3,12 +3,12 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from erpnext.accounts.doctype.share_transfer.share_transfer import ShareDontExists +from erpnext.tests.utils import ERPNextTestSuite -class TestShareTransfer(IntegrationTestCase): +class TestShareTransfer(ERPNextTestSuite): def setUp(self): frappe.db.sql("delete from `tabShare Transfer`") frappe.db.sql("delete from `tabShare Balance`") diff --git a/erpnext/accounts/doctype/share_type/test_share_type.py b/erpnext/accounts/doctype/share_type/test_share_type.py index e6f1f71f4bb..3aa79f53018 100644 --- a/erpnext/accounts/doctype/share_type/test_share_type.py +++ b/erpnext/accounts/doctype/share_type/test_share_type.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestShareType(IntegrationTestCase): +class TestShareType(ERPNextTestSuite): pass diff --git a/erpnext/accounts/doctype/shareholder/test_shareholder.py b/erpnext/accounts/doctype/shareholder/test_shareholder.py index 3c0f34858f9..4c4cc0b789e 100644 --- a/erpnext/accounts/doctype/shareholder/test_shareholder.py +++ b/erpnext/accounts/doctype/shareholder/test_shareholder.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestShareholder(IntegrationTestCase): +class TestShareholder(ERPNextTestSuite): pass diff --git a/erpnext/accounts/doctype/shipping_rule/test_shipping_rule.py b/erpnext/accounts/doctype/shipping_rule/test_shipping_rule.py index be05f5662db..7a36be65817 100644 --- a/erpnext/accounts/doctype/shipping_rule/test_shipping_rule.py +++ b/erpnext/accounts/doctype/shipping_rule/test_shipping_rule.py @@ -3,16 +3,16 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from erpnext.accounts.doctype.shipping_rule.shipping_rule import ( FromGreaterThanToError, ManyBlankToValuesError, OverlappingConditionError, ) +from erpnext.tests.utils import ERPNextTestSuite -class TestShippingRule(IntegrationTestCase): +class TestShippingRule(ERPNextTestSuite): def test_from_greater_than_to(self): shipping_rule = frappe.copy_doc(self.globalTestRecords["Shipping Rule"][0]) shipping_rule.name = self.globalTestRecords["Shipping Rule"][0].get("name") diff --git a/erpnext/accounts/doctype/subscription/test_subscription.py b/erpnext/accounts/doctype/subscription/test_subscription.py index 8dfdb116f36..6e8d72ee9f0 100644 --- a/erpnext/accounts/doctype/subscription/test_subscription.py +++ b/erpnext/accounts/doctype/subscription/test_subscription.py @@ -3,7 +3,6 @@ import frappe -from frappe.tests import IntegrationTestCase from frappe.utils.data import ( add_days, add_months, @@ -19,9 +18,10 @@ from frappe.utils.data import ( from erpnext.accounts.doctype.payment_entry.payment_entry import get_payment_entry from erpnext.accounts.doctype.subscription.subscription import get_prorata_factor +from erpnext.tests.utils import ERPNextTestSuite -class TestSubscription(IntegrationTestCase): +class TestSubscription(ERPNextTestSuite): def setUp(self): make_plans() create_parties() @@ -470,7 +470,7 @@ class TestSubscription(IntegrationTestCase): currency = frappe.db.get_value("Sales Invoice", subscription.invoices[0].name, "currency") self.assertEqual(currency, "USD") - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Accounts Settings", {"allow_multi_currency_invoices_against_single_party_account": 1}, ) diff --git a/erpnext/accounts/doctype/subscription_invoice/test_subscription_invoice.py b/erpnext/accounts/doctype/subscription_invoice/test_subscription_invoice.py index a176a99a9b8..983526fc297 100644 --- a/erpnext/accounts/doctype/subscription_invoice/test_subscription_invoice.py +++ b/erpnext/accounts/doctype/subscription_invoice/test_subscription_invoice.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestSubscriptionInvoice(IntegrationTestCase): +class TestSubscriptionInvoice(ERPNextTestSuite): pass diff --git a/erpnext/accounts/doctype/subscription_plan/test_subscription_plan.py b/erpnext/accounts/doctype/subscription_plan/test_subscription_plan.py index 19b9285b1d8..f2ae2ce85b8 100644 --- a/erpnext/accounts/doctype/subscription_plan/test_subscription_plan.py +++ b/erpnext/accounts/doctype/subscription_plan/test_subscription_plan.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestSubscriptionPlan(IntegrationTestCase): +class TestSubscriptionPlan(ERPNextTestSuite): pass diff --git a/erpnext/accounts/doctype/subscription_settings/test_subscription_settings.py b/erpnext/accounts/doctype/subscription_settings/test_subscription_settings.py index 5d6607cb0cd..ce9193e1130 100644 --- a/erpnext/accounts/doctype/subscription_settings/test_subscription_settings.py +++ b/erpnext/accounts/doctype/subscription_settings/test_subscription_settings.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestSubscriptionSettings(IntegrationTestCase): +class TestSubscriptionSettings(ERPNextTestSuite): pass diff --git a/erpnext/accounts/doctype/tax_category/test_tax_category.py b/erpnext/accounts/doctype/tax_category/test_tax_category.py index fbe654999f1..3eba2808ddb 100644 --- a/erpnext/accounts/doctype/tax_category/test_tax_category.py +++ b/erpnext/accounts/doctype/tax_category/test_tax_category.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestTaxCategory(IntegrationTestCase): +class TestTaxCategory(ERPNextTestSuite): pass diff --git a/erpnext/accounts/doctype/tax_rule/test_tax_rule.py b/erpnext/accounts/doctype/tax_rule/test_tax_rule.py index 2602ea14861..f0bc9696b66 100644 --- a/erpnext/accounts/doctype/tax_rule/test_tax_rule.py +++ b/erpnext/accounts/doctype/tax_rule/test_tax_rule.py @@ -3,14 +3,14 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from erpnext.accounts.doctype.tax_rule.tax_rule import ConflictingTaxRule, get_tax_template from erpnext.crm.doctype.opportunity.opportunity import make_quotation from erpnext.crm.doctype.opportunity.test_opportunity import make_opportunity +from erpnext.tests.utils import ERPNextTestSuite -class TestTaxRule(IntegrationTestCase): +class TestTaxRule(ERPNextTestSuite): @classmethod def setUpClass(cls): super().setUpClass() diff --git a/erpnext/accounts/doctype/tax_withholding_category/test_tax_withholding_category.py b/erpnext/accounts/doctype/tax_withholding_category/test_tax_withholding_category.py index bf1eef735b0..922203637e9 100644 --- a/erpnext/accounts/doctype/tax_withholding_category/test_tax_withholding_category.py +++ b/erpnext/accounts/doctype/tax_withholding_category/test_tax_withholding_category.py @@ -5,15 +5,15 @@ import datetime import frappe from frappe.custom.doctype.custom_field.custom_field import create_custom_fields -from frappe.tests import IntegrationTestCase from frappe.utils import add_days, add_months, today from erpnext.accounts.doctype.payment_entry.payment_entry import get_payment_entry from erpnext.accounts.utils import get_fiscal_year from erpnext.buying.doctype.purchase_order.purchase_order import make_purchase_invoice +from erpnext.tests.utils import ERPNextTestSuite -class TestTaxWithholdingCategory(IntegrationTestCase): +class TestTaxWithholdingCategory(ERPNextTestSuite): @classmethod def setUpClass(cls): super().setUpClass() @@ -2047,7 +2047,7 @@ class TestTaxWithholdingCategory(IntegrationTestCase): self.assertEqual(pi2.taxes, []) self.assertEqual(payment.taxes[0].tax_amount, 6000) - @IntegrationTestCase.change_settings("Accounts Settings", {"delete_linked_ledger_entries": 1}) + @ERPNextTestSuite.change_settings("Accounts Settings", {"delete_linked_ledger_entries": 1}) def test_tds_payment_entry_cancellation(self): """ Test payment entry cancellation clears withholding references from matched entries @@ -2225,7 +2225,7 @@ class TestTaxWithholdingCategory(IntegrationTestCase): self.validate_tax_withholding_entries("Purchase Invoice", pi1.name, expected_entries) self.cleanup_invoices(invoices) - @IntegrationTestCase.change_settings("Accounts Settings", {"delete_linked_ledger_entries": 1}) + @ERPNextTestSuite.change_settings("Accounts Settings", {"delete_linked_ledger_entries": 1}) def test_tds_purchase_invoice_cancellation(self): """ Test that after cancellation, new documents get automatically adjusted against remaining entries diff --git a/erpnext/accounts/doctype/unreconcile_payment/test_unreconcile_payment.py b/erpnext/accounts/doctype/unreconcile_payment/test_unreconcile_payment.py index acd30cc47b7..3b24b4f6242 100644 --- a/erpnext/accounts/doctype/unreconcile_payment/test_unreconcile_payment.py +++ b/erpnext/accounts/doctype/unreconcile_payment/test_unreconcile_payment.py @@ -2,7 +2,6 @@ # See license.txt import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import today from erpnext.accounts.doctype.payment_entry.test_payment_entry import create_payment_entry @@ -12,9 +11,10 @@ from erpnext.accounts.test.accounts_mixin import AccountsTestMixin from erpnext.buying.doctype.purchase_order.test_purchase_order import create_purchase_order from erpnext.selling.doctype.sales_order.sales_order import make_sales_invoice from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order +from erpnext.tests.utils import ERPNextTestSuite -class TestUnreconcilePayment(AccountsTestMixin, IntegrationTestCase): +class TestUnreconcilePayment(AccountsTestMixin, ERPNextTestSuite): def setUp(self): self.create_company() self.create_customer() diff --git a/erpnext/accounts/report/account_balance/test_account_balance.py b/erpnext/accounts/report/account_balance/test_account_balance.py index 37d6f292fb6..f166421b0de 100644 --- a/erpnext/accounts/report/account_balance/test_account_balance.py +++ b/erpnext/accounts/report/account_balance/test_account_balance.py @@ -1,14 +1,14 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import getdate from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice from erpnext.accounts.report.account_balance.account_balance import execute +from erpnext.tests.utils import ERPNextTestSuite -class TestAccountBalance(IntegrationTestCase): +class TestAccountBalance(ERPNextTestSuite): def test_account_balance(self): frappe.db.sql("delete from `tabSales Invoice` where company='_Test Company 2'") frappe.db.sql("delete from `tabGL Entry` where company='_Test Company 2'") diff --git a/erpnext/accounts/report/accounts_payable/test_accounts_payable.py b/erpnext/accounts/report/accounts_payable/test_accounts_payable.py index 8da40ea3aa4..6c306f36966 100644 --- a/erpnext/accounts/report/accounts_payable/test_accounts_payable.py +++ b/erpnext/accounts/report/accounts_payable/test_accounts_payable.py @@ -1,13 +1,13 @@ import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import add_days, today from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import make_purchase_invoice from erpnext.accounts.report.accounts_payable.accounts_payable import execute from erpnext.accounts.test.accounts_mixin import AccountsTestMixin +from erpnext.tests.utils import ERPNextTestSuite -class TestAccountsPayable(AccountsTestMixin, IntegrationTestCase): +class TestAccountsPayable(AccountsTestMixin, ERPNextTestSuite): def setUp(self): self.create_company() self.create_customer() diff --git a/erpnext/accounts/report/accounts_receivable/test_accounts_receivable.py b/erpnext/accounts/report/accounts_receivable/test_accounts_receivable.py index 907840e8ff4..d8836c96479 100644 --- a/erpnext/accounts/report/accounts_receivable/test_accounts_receivable.py +++ b/erpnext/accounts/report/accounts_receivable/test_accounts_receivable.py @@ -1,6 +1,5 @@ import frappe from frappe import qb -from frappe.tests import IntegrationTestCase from frappe.utils import add_days, flt, getdate, today from erpnext.accounts.doctype.payment_entry.payment_entry import get_payment_entry @@ -8,9 +7,10 @@ from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sal from erpnext.accounts.report.accounts_receivable.accounts_receivable import execute from erpnext.accounts.test.accounts_mixin import AccountsTestMixin from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order +from erpnext.tests.utils import ERPNextTestSuite -class TestAccountsReceivable(AccountsTestMixin, IntegrationTestCase): +class TestAccountsReceivable(AccountsTestMixin, ERPNextTestSuite): def setUp(self): self.create_company() self.create_customer() @@ -199,7 +199,7 @@ class TestAccountsReceivable(AccountsTestMixin, IntegrationTestCase): row = report[1] self.assertTrue(len(row) == 0) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Accounts Settings", {"allow_multi_currency_invoices_against_single_party_account": 1}, ) @@ -448,7 +448,7 @@ class TestAccountsReceivable(AccountsTestMixin, IntegrationTestCase): ], ) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Accounts Settings", {"allow_multi_currency_invoices_against_single_party_account": 1, "allow_stale": 0}, ) diff --git a/erpnext/accounts/report/accounts_receivable_summary/test_accounts_receivable_summary.py b/erpnext/accounts/report/accounts_receivable_summary/test_accounts_receivable_summary.py index d357c0d6273..9955d1f7af9 100644 --- a/erpnext/accounts/report/accounts_receivable_summary/test_accounts_receivable_summary.py +++ b/erpnext/accounts/report/accounts_receivable_summary/test_accounts_receivable_summary.py @@ -1,14 +1,14 @@ import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import today from erpnext.accounts.doctype.payment_entry.payment_entry import get_payment_entry from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice from erpnext.accounts.report.accounts_receivable_summary.accounts_receivable_summary import execute from erpnext.accounts.test.accounts_mixin import AccountsTestMixin +from erpnext.tests.utils import ERPNextTestSuite -class TestAccountsReceivable(AccountsTestMixin, IntegrationTestCase): +class TestAccountsReceivable(AccountsTestMixin, ERPNextTestSuite): def setUp(self): self.maxDiff = None self.create_company() @@ -112,7 +112,7 @@ class TestAccountsReceivable(AccountsTestMixin, IntegrationTestCase): self.assertEqual(len(rpt_output), 1) self.assertDictEqual(rpt_output[0], expected_data) - @IntegrationTestCase.change_settings("Selling Settings", {"cust_master_name": "Naming Series"}) + @ERPNextTestSuite.change_settings("Selling Settings", {"cust_master_name": "Naming Series"}) def test_02_various_filters_and_output(self): filters = { "company": self.company, diff --git a/erpnext/accounts/report/balance_sheet/test_balance_sheet.py b/erpnext/accounts/report/balance_sheet/test_balance_sheet.py index 56e3505fafd..dce9d8ab0fa 100644 --- a/erpnext/accounts/report/balance_sheet/test_balance_sheet.py +++ b/erpnext/accounts/report/balance_sheet/test_balance_sheet.py @@ -2,16 +2,16 @@ # MIT License. See license.txt import frappe -from frappe.tests import IntegrationTestCase from frappe.utils.data import today from erpnext.accounts.report.balance_sheet.balance_sheet import execute +from erpnext.tests.utils import ERPNextTestSuite COMPANY = "_Test Company 6" COMPANY_SHORT_NAME = "_TC6" -class TestBalanceSheet(IntegrationTestCase): +class TestBalanceSheet(ERPNextTestSuite): def test_balance_sheet(self): frappe.db.sql(f"delete from `tabJournal Entry` where company='{COMPANY}'") frappe.db.sql(f"delete from `tabGL Entry` where company='{COMPANY}'") diff --git a/erpnext/accounts/report/bank_reconciliation_statement/test_bank_reconciliation_statement.py b/erpnext/accounts/report/bank_reconciliation_statement/test_bank_reconciliation_statement.py index 1fed7a43f7d..2e73a001107 100644 --- a/erpnext/accounts/report/bank_reconciliation_statement/test_bank_reconciliation_statement.py +++ b/erpnext/accounts/report/bank_reconciliation_statement/test_bank_reconciliation_statement.py @@ -2,15 +2,14 @@ # See license.txt import frappe -from frappe.tests import IntegrationTestCase from erpnext.accounts.report.bank_reconciliation_statement.bank_reconciliation_statement import ( execute, ) -from erpnext.tests.utils import if_lending_app_installed +from erpnext.tests.utils import ERPNextTestSuite, if_lending_app_installed -class TestBankReconciliationStatement(IntegrationTestCase): +class TestBankReconciliationStatement(ERPNextTestSuite): @if_lending_app_installed def test_loan_entries_in_bank_reco_statement(self): from lending.loan_management.doctype.loan.test_loan import create_loan_accounts diff --git a/erpnext/accounts/report/customer_ledger_summary/test_customer_ledger_summary.py b/erpnext/accounts/report/customer_ledger_summary/test_customer_ledger_summary.py index 14e88afca39..ddd88eb0018 100644 --- a/erpnext/accounts/report/customer_ledger_summary/test_customer_ledger_summary.py +++ b/erpnext/accounts/report/customer_ledger_summary/test_customer_ledger_summary.py @@ -1,16 +1,16 @@ import frappe from frappe import qb -from frappe.tests import IntegrationTestCase -from frappe.utils import add_days, flt, getdate, today +from frappe.utils import today from erpnext.accounts.doctype.payment_entry.payment_entry import get_payment_entry from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice from erpnext.accounts.report.customer_ledger_summary.customer_ledger_summary import execute from erpnext.accounts.test.accounts_mixin import AccountsTestMixin from erpnext.controllers.sales_and_purchase_return import make_return_doc +from erpnext.tests.utils import ERPNextTestSuite -class TestCustomerLedgerSummary(AccountsTestMixin, IntegrationTestCase): +class TestCustomerLedgerSummary(AccountsTestMixin, ERPNextTestSuite): def setUp(self): self.create_company() self.create_customer() diff --git a/erpnext/accounts/report/deferred_revenue_and_expense/test_deferred_revenue_and_expense.py b/erpnext/accounts/report/deferred_revenue_and_expense/test_deferred_revenue_and_expense.py index fcd9075a30f..eb26fce4038 100644 --- a/erpnext/accounts/report/deferred_revenue_and_expense/test_deferred_revenue_and_expense.py +++ b/erpnext/accounts/report/deferred_revenue_and_expense/test_deferred_revenue_and_expense.py @@ -1,6 +1,5 @@ import frappe from frappe import qb -from frappe.tests import IntegrationTestCase from frappe.utils import nowdate from erpnext.accounts.doctype.account.test_account import create_account @@ -11,9 +10,10 @@ from erpnext.accounts.report.deferred_revenue_and_expense.deferred_revenue_and_e ) from erpnext.accounts.test.accounts_mixin import AccountsTestMixin from erpnext.accounts.utils import get_fiscal_year +from erpnext.tests.utils import ERPNextTestSuite -class TestDeferredRevenueAndExpense(IntegrationTestCase, AccountsTestMixin): +class TestDeferredRevenueAndExpense(ERPNextTestSuite, AccountsTestMixin): maxDiff = None def clear_old_entries(self): @@ -70,7 +70,7 @@ class TestDeferredRevenueAndExpense(IntegrationTestCase, AccountsTestMixin): def tearDown(self): frappe.db.rollback() - @IntegrationTestCase.change_settings("Accounts Settings", {"book_deferred_entries_based_on": "Months"}) + @ERPNextTestSuite.change_settings("Accounts Settings", {"book_deferred_entries_based_on": "Months"}) def test_deferred_revenue(self): self.create_item("_Test Internet Subscription", 0, self.warehouse, self.company) item = frappe.get_doc("Item", self.item) @@ -137,7 +137,7 @@ class TestDeferredRevenueAndExpense(IntegrationTestCase, AccountsTestMixin): ] self.assertEqual(report.period_total, expected) - @IntegrationTestCase.change_settings("Accounts Settings", {"book_deferred_entries_based_on": "Months"}) + @ERPNextTestSuite.change_settings("Accounts Settings", {"book_deferred_entries_based_on": "Months"}) def test_deferred_expense(self): self.create_item("_Test Office Desk", 0, self.warehouse, self.company) item = frappe.get_doc("Item", self.item) @@ -207,7 +207,7 @@ class TestDeferredRevenueAndExpense(IntegrationTestCase, AccountsTestMixin): ] self.assertEqual(report.period_total, expected) - @IntegrationTestCase.change_settings("Accounts Settings", {"book_deferred_entries_based_on": "Months"}) + @ERPNextTestSuite.change_settings("Accounts Settings", {"book_deferred_entries_based_on": "Months"}) def test_zero_months(self): self.create_item("_Test Internet Subscription", 0, self.warehouse, self.company) item = frappe.get_doc("Item", self.item) @@ -272,7 +272,7 @@ class TestDeferredRevenueAndExpense(IntegrationTestCase, AccountsTestMixin): ] self.assertEqual(report.period_total, expected) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Accounts Settings", {"book_deferred_entries_based_on": "Months", "book_deferred_entries_via_journal_entry": 0}, ) diff --git a/erpnext/accounts/report/general_and_payment_ledger_comparison/test_general_and_payment_ledger_comparison.py b/erpnext/accounts/report/general_and_payment_ledger_comparison/test_general_and_payment_ledger_comparison.py index 8c33bc90965..c39aa824629 100644 --- a/erpnext/accounts/report/general_and_payment_ledger_comparison/test_general_and_payment_ledger_comparison.py +++ b/erpnext/accounts/report/general_and_payment_ledger_comparison/test_general_and_payment_ledger_comparison.py @@ -1,6 +1,5 @@ import frappe from frappe import qb -from frappe.tests import IntegrationTestCase from frappe.utils import add_days from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice @@ -8,9 +7,10 @@ from erpnext.accounts.report.general_and_payment_ledger_comparison.general_and_p execute, ) from erpnext.accounts.test.accounts_mixin import AccountsTestMixin +from erpnext.tests.utils import ERPNextTestSuite -class TestGeneralAndPaymentLedger(IntegrationTestCase, AccountsTestMixin): +class TestGeneralAndPaymentLedger(ERPNextTestSuite, AccountsTestMixin): def setUp(self): self.create_company() self.cleanup() diff --git a/erpnext/accounts/report/general_ledger/test_general_ledger.py b/erpnext/accounts/report/general_ledger/test_general_ledger.py index 24280d4d620..8f558467192 100644 --- a/erpnext/accounts/report/general_ledger/test_general_ledger.py +++ b/erpnext/accounts/report/general_ledger/test_general_ledger.py @@ -3,15 +3,15 @@ import frappe from frappe import qb -from frappe.tests import IntegrationTestCase from frappe.utils import flt, today from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice from erpnext.accounts.report.general_ledger.general_ledger import execute from erpnext.controllers.sales_and_purchase_return import make_return_doc +from erpnext.tests.utils import ERPNextTestSuite -class TestGeneralLedger(IntegrationTestCase): +class TestGeneralLedger(ERPNextTestSuite): def setUp(self): self.company = "_Test Company" self.clear_old_entries() diff --git a/erpnext/accounts/report/gross_profit/test_gross_profit.py b/erpnext/accounts/report/gross_profit/test_gross_profit.py index bf52e127544..03473426210 100644 --- a/erpnext/accounts/report/gross_profit/test_gross_profit.py +++ b/erpnext/accounts/report/gross_profit/test_gross_profit.py @@ -1,6 +1,5 @@ import frappe from frappe import qb -from frappe.tests import IntegrationTestCase from frappe.utils import add_days, flt, get_first_day, get_last_day, nowdate from erpnext.accounts.doctype.sales_invoice.sales_invoice import make_delivery_note, make_sales_return @@ -10,9 +9,10 @@ from erpnext.stock.doctype.delivery_note.delivery_note import make_sales_invoice from erpnext.stock.doctype.delivery_note.test_delivery_note import create_delivery_note from erpnext.stock.doctype.item.test_item import create_item from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry +from erpnext.tests.utils import ERPNextTestSuite -class TestGrossProfit(IntegrationTestCase): +class TestGrossProfit(ERPNextTestSuite): def setUp(self): self.create_company() self.create_item() diff --git a/erpnext/accounts/report/item_wise_purchase_register/test_item_wise_purchase_register.py b/erpnext/accounts/report/item_wise_purchase_register/test_item_wise_purchase_register.py index 5a2fe7e23ce..dc0feff3554 100644 --- a/erpnext/accounts/report/item_wise_purchase_register/test_item_wise_purchase_register.py +++ b/erpnext/accounts/report/item_wise_purchase_register/test_item_wise_purchase_register.py @@ -1,13 +1,13 @@ import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import getdate, today from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import make_purchase_invoice from erpnext.accounts.report.item_wise_purchase_register.item_wise_purchase_register import execute from erpnext.accounts.test.accounts_mixin import AccountsTestMixin +from erpnext.tests.utils import ERPNextTestSuite -class TestItemWisePurchaseRegister(AccountsTestMixin, IntegrationTestCase): +class TestItemWisePurchaseRegister(AccountsTestMixin, ERPNextTestSuite): def setUp(self): self.create_company() self.create_supplier() diff --git a/erpnext/accounts/report/item_wise_sales_register/test_item_wise_sales_register.py b/erpnext/accounts/report/item_wise_sales_register/test_item_wise_sales_register.py index 09a2b4a46d6..bb051c5c6e6 100644 --- a/erpnext/accounts/report/item_wise_sales_register/test_item_wise_sales_register.py +++ b/erpnext/accounts/report/item_wise_sales_register/test_item_wise_sales_register.py @@ -1,13 +1,13 @@ import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import getdate, today from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice from erpnext.accounts.report.item_wise_sales_register.item_wise_sales_register import execute from erpnext.accounts.test.accounts_mixin import AccountsTestMixin +from erpnext.tests.utils import ERPNextTestSuite -class TestItemWiseSalesRegister(AccountsTestMixin, IntegrationTestCase): +class TestItemWiseSalesRegister(AccountsTestMixin, ERPNextTestSuite): def setUp(self): self.create_company() self.create_customer() diff --git a/erpnext/accounts/report/payment_ledger/test_payment_ledger.py b/erpnext/accounts/report/payment_ledger/test_payment_ledger.py index 1225fb70101..00206059672 100644 --- a/erpnext/accounts/report/payment_ledger/test_payment_ledger.py +++ b/erpnext/accounts/report/payment_ledger/test_payment_ledger.py @@ -1,13 +1,13 @@ import frappe from frappe import qb -from frappe.tests import IntegrationTestCase from erpnext.accounts.doctype.payment_entry.payment_entry import get_payment_entry from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice from erpnext.accounts.report.payment_ledger.payment_ledger import execute +from erpnext.tests.utils import ERPNextTestSuite -class TestPaymentLedger(IntegrationTestCase): +class TestPaymentLedger(ERPNextTestSuite): def setUp(self): self.create_company() self.cleanup() diff --git a/erpnext/accounts/report/profit_and_loss_statement/test_profit_and_loss_statement.py b/erpnext/accounts/report/profit_and_loss_statement/test_profit_and_loss_statement.py index 4f1a08370a4..172e131efe5 100644 --- a/erpnext/accounts/report/profit_and_loss_statement/test_profit_and_loss_statement.py +++ b/erpnext/accounts/report/profit_and_loss_statement/test_profit_and_loss_statement.py @@ -3,16 +3,16 @@ import frappe from frappe.desk.query_report import export_query -from frappe.tests import IntegrationTestCase from frappe.utils import add_days, getdate, today from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice from erpnext.accounts.report.financial_statements import get_period_list from erpnext.accounts.report.profit_and_loss_statement.profit_and_loss_statement import execute from erpnext.accounts.test.accounts_mixin import AccountsTestMixin +from erpnext.tests.utils import ERPNextTestSuite -class TestProfitAndLossStatement(AccountsTestMixin, IntegrationTestCase): +class TestProfitAndLossStatement(AccountsTestMixin, ERPNextTestSuite): def setUp(self): self.create_company() self.create_customer() diff --git a/erpnext/accounts/report/purchase_register/test_purchase_register.py b/erpnext/accounts/report/purchase_register/test_purchase_register.py index 6f61c44db02..400ee899fa1 100644 --- a/erpnext/accounts/report/purchase_register/test_purchase_register.py +++ b/erpnext/accounts/report/purchase_register/test_purchase_register.py @@ -2,13 +2,13 @@ # MIT License. See license.txt import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import add_months, today from erpnext.accounts.report.purchase_register.purchase_register import execute +from erpnext.tests.utils import ERPNextTestSuite -class TestPurchaseRegister(IntegrationTestCase): +class TestPurchaseRegister(ERPNextTestSuite): def test_purchase_register(self): frappe.db.sql("delete from `tabPurchase Invoice` where company='_Test Company 6'") frappe.db.sql("delete from `tabGL Entry` where company='_Test Company 6'") diff --git a/erpnext/accounts/report/sales_payment_summary/test_sales_payment_summary.py b/erpnext/accounts/report/sales_payment_summary/test_sales_payment_summary.py index 77fcc82c0de..52c240cc60f 100644 --- a/erpnext/accounts/report/sales_payment_summary/test_sales_payment_summary.py +++ b/erpnext/accounts/report/sales_payment_summary/test_sales_payment_summary.py @@ -3,7 +3,6 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import today from erpnext.accounts.doctype.payment_entry.payment_entry import get_payment_entry @@ -11,9 +10,10 @@ from erpnext.accounts.report.sales_payment_summary.sales_payment_summary import get_mode_of_payment_details, get_mode_of_payments, ) +from erpnext.tests.utils import ERPNextTestSuite -class TestSalesPaymentSummary(IntegrationTestCase): +class TestSalesPaymentSummary(ERPNextTestSuite): @classmethod def setUpClass(cls): super().setUpClass() diff --git a/erpnext/accounts/report/sales_register/test_sales_register.py b/erpnext/accounts/report/sales_register/test_sales_register.py index 50f12e52e33..f4292e76471 100644 --- a/erpnext/accounts/report/sales_register/test_sales_register.py +++ b/erpnext/accounts/report/sales_register/test_sales_register.py @@ -1,13 +1,13 @@ import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import getdate, today from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice from erpnext.accounts.report.sales_register.sales_register import execute from erpnext.accounts.test.accounts_mixin import AccountsTestMixin +from erpnext.tests.utils import ERPNextTestSuite -class TestItemWiseSalesRegister(AccountsTestMixin, IntegrationTestCase): +class TestItemWiseSalesRegister(AccountsTestMixin, ERPNextTestSuite): def setUp(self): self.create_company() self.create_customer() diff --git a/erpnext/accounts/report/supplier_ledger_summary/test_supplier_ledger_summary.py b/erpnext/accounts/report/supplier_ledger_summary/test_supplier_ledger_summary.py index 376495b5cc9..6029612666c 100644 --- a/erpnext/accounts/report/supplier_ledger_summary/test_supplier_ledger_summary.py +++ b/erpnext/accounts/report/supplier_ledger_summary/test_supplier_ledger_summary.py @@ -1,13 +1,13 @@ import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import today from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import make_purchase_invoice from erpnext.accounts.report.supplier_ledger_summary.supplier_ledger_summary import execute from erpnext.accounts.test.accounts_mixin import AccountsTestMixin +from erpnext.tests.utils import ERPNextTestSuite -class TestSupplierLedgerSummary(AccountsTestMixin, IntegrationTestCase): +class TestSupplierLedgerSummary(AccountsTestMixin, ERPNextTestSuite): def setUp(self): self.create_company() self.create_supplier() diff --git a/erpnext/accounts/report/tax_withholding_details/test_tax_withholding_details.py b/erpnext/accounts/report/tax_withholding_details/test_tax_withholding_details.py index 30a5df3fcb2..76ed8c79210 100644 --- a/erpnext/accounts/report/tax_withholding_details/test_tax_withholding_details.py +++ b/erpnext/accounts/report/tax_withholding_details/test_tax_withholding_details.py @@ -2,7 +2,6 @@ # MIT License. See license.txt import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import add_to_date, today from erpnext.accounts.doctype.payment_entry.test_payment_entry import create_payment_entry @@ -14,9 +13,10 @@ from erpnext.accounts.doctype.tax_withholding_category.test_tax_withholding_cate from erpnext.accounts.report.tax_withholding_details.tax_withholding_details import execute from erpnext.accounts.test.accounts_mixin import AccountsTestMixin from erpnext.accounts.utils import get_fiscal_year +from erpnext.tests.utils import ERPNextTestSuite -class TestTaxWithholdingDetails(AccountsTestMixin, IntegrationTestCase): +class TestTaxWithholdingDetails(AccountsTestMixin, ERPNextTestSuite): def setUp(self): self.create_company() self.clear_old_entries() diff --git a/erpnext/accounts/report/trial_balance/test_trial_balance.py b/erpnext/accounts/report/trial_balance/test_trial_balance.py index a7922b716e7..4c0c762284e 100644 --- a/erpnext/accounts/report/trial_balance/test_trial_balance.py +++ b/erpnext/accounts/report/trial_balance/test_trial_balance.py @@ -2,13 +2,13 @@ # MIT License. See license.txt import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import today from erpnext.accounts.report.trial_balance.trial_balance import execute +from erpnext.tests.utils import ERPNextTestSuite -class TestTrialBalance(IntegrationTestCase): +class TestTrialBalance(ERPNextTestSuite): def setUp(self): from erpnext.accounts.doctype.account.test_account import create_account from erpnext.accounts.doctype.cost_center.test_cost_center import create_cost_center diff --git a/erpnext/accounts/test/test_reports.py b/erpnext/accounts/test/test_reports.py index c58269dde23..8c27452264c 100644 --- a/erpnext/accounts/test/test_reports.py +++ b/erpnext/accounts/test/test_reports.py @@ -1,8 +1,4 @@ -import unittest - -from frappe.tests import IntegrationTestCase - -from erpnext.tests.utils import ReportFilters, ReportName, execute_script_report +from erpnext.tests.utils import ERPNextTestSuite, ReportFilters, ReportName, execute_script_report DEFAULT_FILTERS = { "company": "_Test Company", @@ -36,7 +32,7 @@ REPORT_FILTER_TEST_CASES: list[tuple[ReportName, ReportFilters]] = [ OPTIONAL_FILTERS = {} -class TestReports(IntegrationTestCase): +class TestReports(ERPNextTestSuite): def test_execute_all_accounts_reports(self): """Test that all script report in stock modules are executable with supported filters""" for report, filter in REPORT_FILTER_TEST_CASES: diff --git a/erpnext/accounts/test/test_utils.py b/erpnext/accounts/test/test_utils.py index fd2dc61096e..5eb652e2112 100644 --- a/erpnext/accounts/test/test_utils.py +++ b/erpnext/accounts/test/test_utils.py @@ -2,7 +2,6 @@ import unittest import frappe from frappe.test_runner import make_test_objects -from frappe.tests import IntegrationTestCase from erpnext.accounts.doctype.payment_entry.payment_entry import get_payment_entry from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import make_purchase_invoice @@ -16,9 +15,10 @@ from erpnext.accounts.utils import ( 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.stock_entry.stock_entry_utils import make_stock_entry +from erpnext.tests.utils import ERPNextTestSuite -class TestUtils(IntegrationTestCase): +class TestUtils(ERPNextTestSuite): @classmethod def setUpClass(cls): super().setUpClass() diff --git a/erpnext/accounts/test_party.py b/erpnext/accounts/test_party.py index 986a5b5d680..0f477103da4 100644 --- a/erpnext/accounts/test_party.py +++ b/erpnext/accounts/test_party.py @@ -1,10 +1,10 @@ import frappe -from frappe.tests import IntegrationTestCase from erpnext.accounts.party import get_default_price_list +from erpnext.tests.utils import ERPNextTestSuite -class PartyTestCase(IntegrationTestCase): +class PartyTestCase(ERPNextTestSuite): def test_get_default_price_list_should_return_none_for_invalid_group(self): customer = frappe.get_doc( { diff --git a/erpnext/assets/doctype/asset/test_asset.py b/erpnext/assets/doctype/asset/test_asset.py index 62e532f322f..87af87a30a4 100644 --- a/erpnext/assets/doctype/asset/test_asset.py +++ b/erpnext/assets/doctype/asset/test_asset.py @@ -3,7 +3,6 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import ( add_days, add_months, @@ -37,9 +36,10 @@ from erpnext.stock.doctype.purchase_receipt.purchase_receipt import ( make_purchase_invoice as make_invoice, ) from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import make_purchase_receipt +from erpnext.tests.utils import ERPNextTestSuite -class AssetSetup(IntegrationTestCase): +class AssetSetup(ERPNextTestSuite): @classmethod def setUpClass(cls): super().setUpClass() diff --git a/erpnext/assets/doctype/asset_activity/test_asset_activity.py b/erpnext/assets/doctype/asset_activity/test_asset_activity.py index 1c7d472c88b..0344c7d984b 100644 --- a/erpnext/assets/doctype/asset_activity/test_asset_activity.py +++ b/erpnext/assets/doctype/asset_activity/test_asset_activity.py @@ -2,8 +2,10 @@ # See license.txt # import frappe -from frappe.tests import IntegrationTestCase -class TestAssetActivity(IntegrationTestCase): +from erpnext.tests.utils import ERPNextTestSuite + + +class TestAssetActivity(ERPNextTestSuite): pass diff --git a/erpnext/assets/doctype/asset_capitalization/test_asset_capitalization.py b/erpnext/assets/doctype/asset_capitalization/test_asset_capitalization.py index 914b87b728f..2e05f24e06e 100644 --- a/erpnext/assets/doctype/asset_capitalization/test_asset_capitalization.py +++ b/erpnext/assets/doctype/asset_capitalization/test_asset_capitalization.py @@ -3,8 +3,7 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase -from frappe.utils import cint, flt, getdate, now_datetime +from frappe.utils import cint, flt, now_datetime from erpnext.assets.doctype.asset.depreciation import post_depreciation_entries from erpnext.assets.doctype.asset.test_asset import ( @@ -21,9 +20,10 @@ from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import make_pu from erpnext.stock.doctype.serial_and_batch_bundle.test_serial_and_batch_bundle import ( make_serial_batch_bundle, ) +from erpnext.tests.utils import ERPNextTestSuite -class TestAssetCapitalization(IntegrationTestCase): +class TestAssetCapitalization(ERPNextTestSuite): def setUp(self): set_depreciation_settings_in_company() create_asset_data() diff --git a/erpnext/assets/doctype/asset_category/test_asset_category.py b/erpnext/assets/doctype/asset_category/test_asset_category.py index 0f903c7f03a..9f1e6821b43 100644 --- a/erpnext/assets/doctype/asset_category/test_asset_category.py +++ b/erpnext/assets/doctype/asset_category/test_asset_category.py @@ -3,10 +3,12 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase + +from erpnext.assets.doctype.asset.test_asset import create_asset +from erpnext.tests.utils import ERPNextTestSuite -class TestAssetCategory(IntegrationTestCase): +class TestAssetCategory(ERPNextTestSuite): def test_mandatory_fields(self): asset_category = frappe.new_doc("Asset Category") asset_category.asset_category_name = "Computers" diff --git a/erpnext/assets/doctype/asset_depreciation_schedule/test_asset_depreciation_schedule.py b/erpnext/assets/doctype/asset_depreciation_schedule/test_asset_depreciation_schedule.py index 824c7cbba1f..c3184f5b224 100644 --- a/erpnext/assets/doctype/asset_depreciation_schedule/test_asset_depreciation_schedule.py +++ b/erpnext/assets/doctype/asset_depreciation_schedule/test_asset_depreciation_schedule.py @@ -2,8 +2,7 @@ # See license.txt import frappe -from frappe.tests import IntegrationTestCase -from frappe.utils import cstr, date_diff, flt, getdate +from frappe.utils import cstr, flt, getdate from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice from erpnext.assets.doctype.asset.depreciation import ( @@ -18,9 +17,10 @@ from erpnext.assets.doctype.asset_repair.test_asset_repair import create_asset_r from erpnext.assets.doctype.asset_value_adjustment.test_asset_value_adjustment import ( make_asset_value_adjustment, ) +from erpnext.tests.utils import ERPNextTestSuite -class TestAssetDepreciationSchedule(IntegrationTestCase): +class TestAssetDepreciationSchedule(ERPNextTestSuite): def setUp(self): create_asset_data() diff --git a/erpnext/assets/doctype/asset_maintenance/test_asset_maintenance.py b/erpnext/assets/doctype/asset_maintenance/test_asset_maintenance.py index 391872c8438..7077789e387 100644 --- a/erpnext/assets/doctype/asset_maintenance/test_asset_maintenance.py +++ b/erpnext/assets/doctype/asset_maintenance/test_asset_maintenance.py @@ -3,14 +3,14 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import add_days, get_last_day, nowdate from erpnext.assets.doctype.asset_maintenance.asset_maintenance import calculate_next_due_date from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import make_purchase_receipt +from erpnext.tests.utils import ERPNextTestSuite -class TestAssetMaintenance(IntegrationTestCase): +class TestAssetMaintenance(ERPNextTestSuite): def setUp(self): set_depreciation_settings_in_company() self.pr = make_purchase_receipt( diff --git a/erpnext/assets/doctype/asset_maintenance_log/test_asset_maintenance_log.py b/erpnext/assets/doctype/asset_maintenance_log/test_asset_maintenance_log.py index 6d19f5b17d9..e5f421c94ed 100644 --- a/erpnext/assets/doctype/asset_maintenance_log/test_asset_maintenance_log.py +++ b/erpnext/assets/doctype/asset_maintenance_log/test_asset_maintenance_log.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestAssetMaintenanceLog(IntegrationTestCase): +class TestAssetMaintenanceLog(ERPNextTestSuite): pass diff --git a/erpnext/assets/doctype/asset_maintenance_team/test_asset_maintenance_team.py b/erpnext/assets/doctype/asset_maintenance_team/test_asset_maintenance_team.py index 00441a8368a..6def5ed28b9 100644 --- a/erpnext/assets/doctype/asset_maintenance_team/test_asset_maintenance_team.py +++ b/erpnext/assets/doctype/asset_maintenance_team/test_asset_maintenance_team.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestAssetMaintenanceTeam(IntegrationTestCase): +class TestAssetMaintenanceTeam(ERPNextTestSuite): pass diff --git a/erpnext/assets/doctype/asset_movement/test_asset_movement.py b/erpnext/assets/doctype/asset_movement/test_asset_movement.py index 0cceb011a25..6e70c477d7c 100644 --- a/erpnext/assets/doctype/asset_movement/test_asset_movement.py +++ b/erpnext/assets/doctype/asset_movement/test_asset_movement.py @@ -3,15 +3,15 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import add_days, now from erpnext.assets.doctype.asset.test_asset import create_asset, create_asset_data from erpnext.setup.doctype.employee.test_employee import make_employee from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import make_purchase_receipt +from erpnext.tests.utils import ERPNextTestSuite -class TestAssetMovement(IntegrationTestCase): +class TestAssetMovement(ERPNextTestSuite): def setUp(self): frappe.db.set_value( "Company", "_Test Company", "capital_work_in_progress_account", "CWIP Account - _TC" diff --git a/erpnext/assets/doctype/asset_repair/test_asset_repair.py b/erpnext/assets/doctype/asset_repair/test_asset_repair.py index c56622d6665..9a837ca3853 100644 --- a/erpnext/assets/doctype/asset_repair/test_asset_repair.py +++ b/erpnext/assets/doctype/asset_repair/test_asset_repair.py @@ -26,9 +26,10 @@ from erpnext.stock.doctype.serial_and_batch_bundle.test_serial_and_batch_bundle get_serial_nos_from_bundle, make_serial_batch_bundle, ) +from erpnext.tests.utils import ERPNextTestSuite -class TestAssetRepair(IntegrationTestCase): +class TestAssetRepair(ERPNextTestSuite): @classmethod def setUpClass(cls): super().setUpClass() diff --git a/erpnext/assets/doctype/asset_shift_allocation/test_asset_shift_allocation.py b/erpnext/assets/doctype/asset_shift_allocation/test_asset_shift_allocation.py index 2764a2cc373..8c061615486 100644 --- a/erpnext/assets/doctype/asset_shift_allocation/test_asset_shift_allocation.py +++ b/erpnext/assets/doctype/asset_shift_allocation/test_asset_shift_allocation.py @@ -2,16 +2,16 @@ # See license.txt import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import cstr from erpnext.assets.doctype.asset.test_asset import create_asset from erpnext.assets.doctype.asset_depreciation_schedule.asset_depreciation_schedule import ( get_depr_schedule, ) +from erpnext.tests.utils import ERPNextTestSuite -class TestAssetShiftAllocation(IntegrationTestCase): +class TestAssetShiftAllocation(ERPNextTestSuite): @classmethod def setUpClass(cls): super().setUpClass() diff --git a/erpnext/assets/doctype/asset_shift_factor/test_asset_shift_factor.py b/erpnext/assets/doctype/asset_shift_factor/test_asset_shift_factor.py index 12d68b02c5f..7470e55b6fb 100644 --- a/erpnext/assets/doctype/asset_shift_factor/test_asset_shift_factor.py +++ b/erpnext/assets/doctype/asset_shift_factor/test_asset_shift_factor.py @@ -2,8 +2,10 @@ # See license.txt # import frappe -from frappe.tests import IntegrationTestCase -class TestAssetShiftFactor(IntegrationTestCase): +from erpnext.tests.utils import ERPNextTestSuite + + +class TestAssetShiftFactor(ERPNextTestSuite): pass diff --git a/erpnext/assets/doctype/asset_value_adjustment/test_asset_value_adjustment.py b/erpnext/assets/doctype/asset_value_adjustment/test_asset_value_adjustment.py index 1425bb9aa78..b732ddbf1a1 100644 --- a/erpnext/assets/doctype/asset_value_adjustment/test_asset_value_adjustment.py +++ b/erpnext/assets/doctype/asset_value_adjustment/test_asset_value_adjustment.py @@ -3,7 +3,6 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import add_days, cstr, get_last_day, getdate, nowdate from erpnext.assets.doctype.asset.asset import get_asset_value_after_depreciation @@ -14,9 +13,10 @@ from erpnext.assets.doctype.asset_depreciation_schedule.asset_depreciation_sched ) from erpnext.assets.doctype.asset_repair.test_asset_repair import create_asset_repair from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import make_purchase_receipt +from erpnext.tests.utils import ERPNextTestSuite -class TestAssetValueAdjustment(IntegrationTestCase): +class TestAssetValueAdjustment(ERPNextTestSuite): def setUp(self): create_asset_data() frappe.db.set_value( diff --git a/erpnext/assets/doctype/location/test_location.py b/erpnext/assets/doctype/location/test_location.py index 8de97138f7b..771a99d2380 100644 --- a/erpnext/assets/doctype/location/test_location.py +++ b/erpnext/assets/doctype/location/test_location.py @@ -4,10 +4,11 @@ import json import unittest import frappe -from frappe.tests import IntegrationTestCase + +from erpnext.tests.utils import ERPNextTestSuite -class TestLocation(IntegrationTestCase): +class TestLocation(ERPNextTestSuite): def runTest(self): locations = ["Basil Farm", "Division 1", "Field 1", "Block 1"] area = 0 diff --git a/erpnext/assets/doctype/maintenance_team_member/test_maintenance_team_member.py b/erpnext/assets/doctype/maintenance_team_member/test_maintenance_team_member.py index a4795c54a56..b53649b822d 100644 --- a/erpnext/assets/doctype/maintenance_team_member/test_maintenance_team_member.py +++ b/erpnext/assets/doctype/maintenance_team_member/test_maintenance_team_member.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestMaintenanceTeamMember(IntegrationTestCase): +class TestMaintenanceTeamMember(ERPNextTestSuite): pass diff --git a/erpnext/bulk_transaction/doctype/bulk_transaction_log/test_bulk_transaction_log.py b/erpnext/bulk_transaction/doctype/bulk_transaction_log/test_bulk_transaction_log.py index 66e6456d103..e3909ea619a 100644 --- a/erpnext/bulk_transaction/doctype/bulk_transaction_log/test_bulk_transaction_log.py +++ b/erpnext/bulk_transaction/doctype/bulk_transaction_log/test_bulk_transaction_log.py @@ -2,8 +2,10 @@ # See license.txt # import frappe -from frappe.tests import IntegrationTestCase -class TestBulkTransactionLog(IntegrationTestCase): +from erpnext.tests.utils import ERPNextTestSuite + + +class TestBulkTransactionLog(ERPNextTestSuite): pass diff --git a/erpnext/bulk_transaction/doctype/bulk_transaction_log_detail/test_bulk_transaction_log_detail.py b/erpnext/bulk_transaction/doctype/bulk_transaction_log_detail/test_bulk_transaction_log_detail.py index 6b9b4637ab4..ae35c697c31 100644 --- a/erpnext/bulk_transaction/doctype/bulk_transaction_log_detail/test_bulk_transaction_log_detail.py +++ b/erpnext/bulk_transaction/doctype/bulk_transaction_log_detail/test_bulk_transaction_log_detail.py @@ -2,8 +2,10 @@ # See license.txt # import frappe -from frappe.tests import IntegrationTestCase -class TestBulkTransactionLogDetail(IntegrationTestCase): +from erpnext.tests.utils import ERPNextTestSuite + + +class TestBulkTransactionLogDetail(ERPNextTestSuite): pass diff --git a/erpnext/buying/doctype/buying_settings/test_buying_settings.py b/erpnext/buying/doctype/buying_settings/test_buying_settings.py index 04f95dbe745..c583ad6875e 100644 --- a/erpnext/buying/doctype/buying_settings/test_buying_settings.py +++ b/erpnext/buying/doctype/buying_settings/test_buying_settings.py @@ -3,8 +3,8 @@ # import frappe import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestBuyingSettings(IntegrationTestCase): +class TestBuyingSettings(ERPNextTestSuite): pass diff --git a/erpnext/buying/doctype/purchase_order/test_purchase_order.py b/erpnext/buying/doctype/purchase_order/test_purchase_order.py index b815ae34e1c..f2803dd2b95 100644 --- a/erpnext/buying/doctype/purchase_order/test_purchase_order.py +++ b/erpnext/buying/doctype/purchase_order/test_purchase_order.py @@ -5,7 +5,7 @@ import json import frappe -from frappe.tests import IntegrationTestCase, change_settings +from frappe.tests import change_settings from frappe.utils import add_days, flt, getdate, nowdate from frappe.utils.data import today @@ -26,9 +26,10 @@ from erpnext.stock.doctype.material_request.test_material_request import make_ma from erpnext.stock.doctype.purchase_receipt.purchase_receipt import ( make_purchase_invoice as make_pi_from_pr, ) +from erpnext.tests.utils import ERPNextTestSuite -class TestPurchaseOrder(IntegrationTestCase): +class TestPurchaseOrder(ERPNextTestSuite): def test_purchase_order_qty(self): po = create_purchase_order(qty=1, do_not_save=True) @@ -540,7 +541,7 @@ class TestPurchaseOrder(IntegrationTestCase): self.assertRaises(frappe.ValidationError, pr.submit) self.assertRaises(frappe.ValidationError, pi.submit) - @IntegrationTestCase.change_settings("Accounts Settings", {"automatically_fetch_payment_terms": 1}) + @ERPNextTestSuite.change_settings("Accounts Settings", {"automatically_fetch_payment_terms": 1}) def test_make_purchase_invoice_with_terms(self): po = create_purchase_order(do_not_save=True) @@ -712,7 +713,7 @@ class TestPurchaseOrder(IntegrationTestCase): ) self.assertEqual(due_date, "2023-03-31") - @IntegrationTestCase.change_settings("Accounts Settings", {"automatically_fetch_payment_terms": 0}) + @ERPNextTestSuite.change_settings("Accounts Settings", {"automatically_fetch_payment_terms": 0}) def test_terms_are_not_copied_if_automatically_fetch_payment_terms_is_unchecked(self): po = create_purchase_order(do_not_save=1) po.payment_terms_template = "_Test Payment Term Template" @@ -737,7 +738,7 @@ class TestPurchaseOrder(IntegrationTestCase): pi.insert() self.assertTrue(pi.get("payment_schedule")) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Accounts Settings", {"unlink_advance_payment_on_cancelation_of_order": 1} ) def test_advance_payment_entry_unlink_against_purchase_order(self): @@ -810,7 +811,7 @@ class TestPurchaseOrder(IntegrationTestCase): company_doc.book_advance_payments_in_separate_party_account = False company_doc.save() - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Accounts Settings", {"unlink_advance_payment_on_cancelation_of_order": 1} ) def test_advance_paid_upon_payment_entry_cancellation(self): @@ -906,7 +907,7 @@ class TestPurchaseOrder(IntegrationTestCase): bo.load_from_db() self.assertEqual(bo.items[0].ordered_qty, 5) - @IntegrationTestCase.change_settings("Accounts Settings", {"automatically_fetch_payment_terms": 1}) + @ERPNextTestSuite.change_settings("Accounts Settings", {"automatically_fetch_payment_terms": 1}) def test_payment_terms_are_fetched_when_creating_purchase_invoice(self): from erpnext.accounts.doctype.payment_entry.test_payment_entry import ( create_payment_terms_template, @@ -1145,7 +1146,7 @@ class TestPurchaseOrder(IntegrationTestCase): # Test - 8: Since this PO is now fully subcontracted, creating a new SCO from it should throw error self.assertRaises(frappe.ValidationError, make_subcontracting_order, po.name) - @IntegrationTestCase.change_settings("Buying Settings", {"auto_create_subcontracting_order": 1}) + @ERPNextTestSuite.change_settings("Buying Settings", {"auto_create_subcontracting_order": 1}) def test_auto_create_subcontracting_order(self): from erpnext.controllers.tests.test_subcontracting_controller import ( make_bom_for_subcontracted_items, @@ -1237,7 +1238,7 @@ class TestPurchaseOrder(IntegrationTestCase): po.reload() self.assertEqual(po.per_billed, 100) - @IntegrationTestCase.change_settings("Buying Settings", {"allow_zero_qty_in_purchase_order": 1}) + @ERPNextTestSuite.change_settings("Buying Settings", {"allow_zero_qty_in_purchase_order": 1}) def test_receive_zero_qty_purchase_order(self): """ Test the flow of a Unit Price PO and PR creation against it until completion. @@ -1286,7 +1287,7 @@ class TestPurchaseOrder(IntegrationTestCase): self.assertEqual(po.per_received, 100.0) self.assertEqual(po.status, "To Bill") - @IntegrationTestCase.change_settings("Buying Settings", {"allow_zero_qty_in_purchase_order": 1}) + @ERPNextTestSuite.change_settings("Buying Settings", {"allow_zero_qty_in_purchase_order": 1}) def test_bill_zero_qty_purchase_order(self): po = create_purchase_order(qty=0) @@ -1311,7 +1312,7 @@ class TestPurchaseOrder(IntegrationTestCase): self.assertFalse(po.per_billed) self.assertEqual(po.status, "To Receive and Bill") - @IntegrationTestCase.change_settings("Buying Settings", {"maintain_same_rate": 0}) + @ERPNextTestSuite.change_settings("Buying Settings", {"maintain_same_rate": 0}) def test_purchase_invoice_creation_with_partial_qty(self): po = create_purchase_order(qty=100, rate=10) diff --git a/erpnext/buying/doctype/request_for_quotation/test_request_for_quotation.py b/erpnext/buying/doctype/request_for_quotation/test_request_for_quotation.py index 425d172629d..9201f6c4f2d 100644 --- a/erpnext/buying/doctype/request_for_quotation/test_request_for_quotation.py +++ b/erpnext/buying/doctype/request_for_quotation/test_request_for_quotation.py @@ -5,7 +5,7 @@ from urllib.parse import urlparse import frappe -from frappe.tests import IntegrationTestCase, change_settings +from frappe.tests import change_settings from frappe.utils import nowdate from erpnext.buying.doctype.request_for_quotation.request_for_quotation import ( @@ -19,9 +19,10 @@ from erpnext.crm.doctype.opportunity.opportunity import make_request_for_quotati from erpnext.crm.doctype.opportunity.test_opportunity import make_opportunity from erpnext.stock.doctype.item.test_item import make_item from erpnext.templates.pages.rfq import check_supplier_has_docname_access +from erpnext.tests.utils import ERPNextTestSuite -class TestRequestforQuotation(IntegrationTestCase): +class TestRequestforQuotation(ERPNextTestSuite): def test_rfq_qty(self): rfq = make_request_for_quotation(qty=0, do_not_save=True) with self.assertRaises(InvalidQtyError): @@ -222,7 +223,7 @@ class TestRequestforQuotation(IntegrationTestCase): supplier_doc.reload() self.assertTrue(supplier_doc.portal_users[0].user) - @IntegrationTestCase.change_settings("Buying Settings", {"allow_zero_qty_in_request_for_quotation": 1}) + @ERPNextTestSuite.change_settings("Buying Settings", {"allow_zero_qty_in_request_for_quotation": 1}) def test_supplier_quotation_from_zero_qty_rfq(self): rfq = make_request_for_quotation(qty=0) sq = make_supplier_quotation_from_rfq(rfq.name, for_supplier=rfq.get("suppliers")[0].supplier) @@ -231,7 +232,7 @@ class TestRequestforQuotation(IntegrationTestCase): self.assertEqual(sq.items[0].qty, 0) self.assertEqual(sq.items[0].item_code, rfq.items[0].item_code) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Buying Settings", { "allow_zero_qty_in_request_for_quotation": 1, diff --git a/erpnext/buying/doctype/supplier/test_supplier.py b/erpnext/buying/doctype/supplier/test_supplier.py index f1e2d88473b..663a7b48e46 100644 --- a/erpnext/buying/doctype/supplier/test_supplier.py +++ b/erpnext/buying/doctype/supplier/test_supplier.py @@ -3,15 +3,15 @@ import frappe -from frappe.tests import IntegrationTestCase, UnitTestCase +from frappe.tests import UnitTestCase from erpnext.accounts.party import get_due_date from erpnext.controllers.website_list_for_contact import get_customers_suppliers from erpnext.exceptions import PartyDisabled +from erpnext.tests.utils import ERPNextTestSuite - -class TestSupplier(IntegrationTestCase): +class TestSupplier(ERPNextTestSuite): def test_get_supplier_group_details(self): doc = frappe.new_doc("Supplier Group") doc.supplier_group_name = "_Testing Supplier Group" @@ -172,7 +172,10 @@ def create_supplier(**args): return doc -class TestSupplierPortal(IntegrationTestCase): +from erpnext.tests.utils import ERPNextTestSuite + + +class TestSupplierPortal(ERPNextTestSuite): def test_portal_user_can_access_supplier_data(self): supplier = create_supplier() diff --git a/erpnext/buying/doctype/supplier_quotation/test_supplier_quotation.py b/erpnext/buying/doctype/supplier_quotation/test_supplier_quotation.py index 7c2714ba671..6c644707fa1 100644 --- a/erpnext/buying/doctype/supplier_quotation/test_supplier_quotation.py +++ b/erpnext/buying/doctype/supplier_quotation/test_supplier_quotation.py @@ -5,14 +5,15 @@ import json import frappe -from frappe.tests import IntegrationTestCase, change_settings +from frappe.tests import change_settings from frappe.utils import add_days, today from erpnext.buying.doctype.supplier_quotation.supplier_quotation import make_purchase_order from erpnext.controllers.accounts_controller import InvalidQtyError, update_child_qty_rate +from erpnext.tests.utils import ERPNextTestSuite -class TestPurchaseOrder(IntegrationTestCase): +class TestPurchaseOrder(ERPNextTestSuite): def test_update_child_supplier_quotation_add_item(self): sq = frappe.copy_doc(self.globalTestRecords["Supplier Quotation"][0]) sq.submit() @@ -166,7 +167,7 @@ class TestPurchaseOrder(IntegrationTestCase): po.insert() - @IntegrationTestCase.change_settings("Buying Settings", {"allow_zero_qty_in_supplier_quotation": 1}) + @ERPNextTestSuite.change_settings("Buying Settings", {"allow_zero_qty_in_supplier_quotation": 1}) def test_map_purchase_order_from_zero_qty_supplier_quotation(self): sq = frappe.copy_doc(self.globalTestRecords["Supplier Quotation"][0]) sq.items[0].qty = 0 diff --git a/erpnext/buying/doctype/supplier_scorecard/test_supplier_scorecard.py b/erpnext/buying/doctype/supplier_scorecard/test_supplier_scorecard.py index c65ebe2086f..a1d1dfc4709 100644 --- a/erpnext/buying/doctype/supplier_scorecard/test_supplier_scorecard.py +++ b/erpnext/buying/doctype/supplier_scorecard/test_supplier_scorecard.py @@ -3,10 +3,11 @@ import frappe -from frappe.tests import IntegrationTestCase + +from erpnext.tests.utils import ERPNextTestSuite -class TestSupplierScorecard(IntegrationTestCase): +class TestSupplierScorecard(ERPNextTestSuite): def test_create_scorecard(self): doc = make_supplier_scorecard().insert() self.assertEqual(doc.name, valid_scorecard[0].get("supplier")) diff --git a/erpnext/buying/doctype/supplier_scorecard_criteria/test_supplier_scorecard_criteria.py b/erpnext/buying/doctype/supplier_scorecard_criteria/test_supplier_scorecard_criteria.py index 114ff2b56b3..951d33ed901 100644 --- a/erpnext/buying/doctype/supplier_scorecard_criteria/test_supplier_scorecard_criteria.py +++ b/erpnext/buying/doctype/supplier_scorecard_criteria/test_supplier_scorecard_criteria.py @@ -3,10 +3,11 @@ import frappe -from frappe.tests import IntegrationTestCase + +from erpnext.tests.utils import ERPNextTestSuite -class TestSupplierScorecardCriteria(IntegrationTestCase): +class TestSupplierScorecardCriteria(ERPNextTestSuite): def test_variables_exist(self): delete_test_scorecards() for d in test_good_criteria: diff --git a/erpnext/buying/doctype/supplier_scorecard_period/test_supplier_scorecard_period.py b/erpnext/buying/doctype/supplier_scorecard_period/test_supplier_scorecard_period.py index 2b124dede99..6fd2bc3b0cc 100644 --- a/erpnext/buying/doctype/supplier_scorecard_period/test_supplier_scorecard_period.py +++ b/erpnext/buying/doctype/supplier_scorecard_period/test_supplier_scorecard_period.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestSupplierScorecardPeriod(IntegrationTestCase): +class TestSupplierScorecardPeriod(ERPNextTestSuite): pass diff --git a/erpnext/buying/doctype/supplier_scorecard_standing/test_supplier_scorecard_standing.py b/erpnext/buying/doctype/supplier_scorecard_standing/test_supplier_scorecard_standing.py index 32581538b03..8cc89e941fb 100644 --- a/erpnext/buying/doctype/supplier_scorecard_standing/test_supplier_scorecard_standing.py +++ b/erpnext/buying/doctype/supplier_scorecard_standing/test_supplier_scorecard_standing.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestSupplierScorecardStanding(IntegrationTestCase): +class TestSupplierScorecardStanding(ERPNextTestSuite): pass diff --git a/erpnext/buying/doctype/supplier_scorecard_variable/test_supplier_scorecard_variable.py b/erpnext/buying/doctype/supplier_scorecard_variable/test_supplier_scorecard_variable.py index 8f4b2f4ecdf..f390eefcc65 100644 --- a/erpnext/buying/doctype/supplier_scorecard_variable/test_supplier_scorecard_variable.py +++ b/erpnext/buying/doctype/supplier_scorecard_variable/test_supplier_scorecard_variable.py @@ -3,14 +3,14 @@ import frappe -from frappe.tests import IntegrationTestCase from erpnext.buying.doctype.supplier_scorecard_variable.supplier_scorecard_variable import ( VariablePathNotFound, ) +from erpnext.tests.utils import ERPNextTestSuite -class TestSupplierScorecardVariable(IntegrationTestCase): +class TestSupplierScorecardVariable(ERPNextTestSuite): def test_variable_exist(self): for d in test_existing_variables: my_doc = frappe.get_doc("Supplier Scorecard Variable", d.get("name")) diff --git a/erpnext/buying/report/procurement_tracker/test_procurement_tracker.py b/erpnext/buying/report/procurement_tracker/test_procurement_tracker.py index f344730a7fa..1577bf2cbf6 100644 --- a/erpnext/buying/report/procurement_tracker/test_procurement_tracker.py +++ b/erpnext/buying/report/procurement_tracker/test_procurement_tracker.py @@ -2,8 +2,8 @@ # For license information, please see license.txt -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestProcurementTracker(IntegrationTestCase): +class TestProcurementTracker(ERPNextTestSuite): pass diff --git a/erpnext/buying/report/requested_items_to_order_and_receive/test_requested_items_to_order_and_receive.py b/erpnext/buying/report/requested_items_to_order_and_receive/test_requested_items_to_order_and_receive.py index ca0b1abad0c..e3f666d8e08 100644 --- a/erpnext/buying/report/requested_items_to_order_and_receive/test_requested_items_to_order_and_receive.py +++ b/erpnext/buying/report/requested_items_to_order_and_receive/test_requested_items_to_order_and_receive.py @@ -2,7 +2,6 @@ # See license.txt import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import add_days, today from erpnext.buying.doctype.purchase_order.purchase_order import make_purchase_receipt @@ -11,9 +10,10 @@ from erpnext.buying.report.requested_items_to_order_and_receive.requested_items_ ) from erpnext.stock.doctype.item.test_item import create_item from erpnext.stock.doctype.material_request.material_request import make_purchase_order +from erpnext.tests.utils import ERPNextTestSuite -class TestRequestedItemsToOrderAndReceive(IntegrationTestCase): +class TestRequestedItemsToOrderAndReceive(ERPNextTestSuite): def setUp(self) -> None: create_item("Test MR Report Item") self.setup_material_request() # to order and receive diff --git a/erpnext/buying/report/subcontracted_item_to_be_received/test_subcontracted_item_to_be_received.py b/erpnext/buying/report/subcontracted_item_to_be_received/test_subcontracted_item_to_be_received.py index 5a4c8ec6ba0..1b6bf653a77 100644 --- a/erpnext/buying/report/subcontracted_item_to_be_received/test_subcontracted_item_to_be_received.py +++ b/erpnext/buying/report/subcontracted_item_to_be_received/test_subcontracted_item_to_be_received.py @@ -7,7 +7,6 @@ import copy import frappe -from frappe.tests import IntegrationTestCase from erpnext.buying.report.subcontracted_item_to_be_received.subcontracted_item_to_be_received import ( execute, @@ -22,9 +21,10 @@ from erpnext.controllers.tests.test_subcontracting_controller import ( from erpnext.subcontracting.doctype.subcontracting_order.subcontracting_order import ( make_subcontracting_receipt, ) +from erpnext.tests.utils import ERPNextTestSuite -class TestSubcontractedItemToBeReceived(IntegrationTestCase): +class TestSubcontractedItemToBeReceived(ERPNextTestSuite): def test_pending_and_received_qty(self): make_service_item("Subcontracted Service Item 1") service_items = [ diff --git a/erpnext/buying/report/subcontracted_raw_materials_to_be_transferred/test_subcontracted_raw_materials_to_be_transferred.py b/erpnext/buying/report/subcontracted_raw_materials_to_be_transferred/test_subcontracted_raw_materials_to_be_transferred.py index 3553906ae63..ee76c50261d 100644 --- a/erpnext/buying/report/subcontracted_raw_materials_to_be_transferred/test_subcontracted_raw_materials_to_be_transferred.py +++ b/erpnext/buying/report/subcontracted_raw_materials_to_be_transferred/test_subcontracted_raw_materials_to_be_transferred.py @@ -4,7 +4,6 @@ # Decompiled by https://python-decompiler.com import frappe -from frappe.tests import IntegrationTestCase from erpnext.buying.report.subcontracted_raw_materials_to_be_transferred.subcontracted_raw_materials_to_be_transferred import ( execute, @@ -15,9 +14,10 @@ from erpnext.controllers.tests.test_subcontracting_controller import ( make_service_item, ) from erpnext.stock.doctype.stock_entry.test_stock_entry import make_stock_entry +from erpnext.tests.utils import ERPNextTestSuite -class TestSubcontractedItemToBeTransferred(IntegrationTestCase): +class TestSubcontractedItemToBeTransferred(ERPNextTestSuite): def test_pending_and_transferred_qty(self): make_service_item("Subcontracted Service Item 1") service_items = [ diff --git a/erpnext/controllers/tests/test_accounts_controller.py b/erpnext/controllers/tests/test_accounts_controller.py index 553a7246fea..9b330aa7ee2 100644 --- a/erpnext/controllers/tests/test_accounts_controller.py +++ b/erpnext/controllers/tests/test_accounts_controller.py @@ -5,7 +5,6 @@ import frappe from frappe import qb from frappe.query_builder.functions import Sum -from frappe.tests import IntegrationTestCase from frappe.utils import add_days, getdate, nowdate from frappe.utils.data import getdate as convert_to_date @@ -20,6 +19,7 @@ from erpnext.buying.doctype.purchase_order.test_purchase_order import ( ) from erpnext.projects.doctype.project.test_project import make_project from erpnext.stock.doctype.item.test_item import create_item +from erpnext.tests.utils import ERPNextTestSuite def make_customer(customer_name, currency=None): @@ -51,7 +51,7 @@ def make_supplier(supplier_name, currency=None): return supplier_name -class TestAccountsController(IntegrationTestCase): +class TestAccountsController(ERPNextTestSuite): """ Test Exchange Gain/Loss booking on various scenarios. Test Cases are numbered for better organization @@ -810,9 +810,7 @@ class TestAccountsController(IntegrationTestCase): self.assertEqual(exc_je_for_si, []) self.assertEqual(exc_je_for_pe, []) - @IntegrationTestCase.change_settings( - "Stock Settings", {"allow_internal_transfer_at_arms_length_price": 1} - ) + @ERPNextTestSuite.change_settings("Stock Settings", {"allow_internal_transfer_at_arms_length_price": 1}) def test_16_internal_transfer_at_arms_length_price(self): from erpnext.accounts.doctype.sales_invoice.sales_invoice import make_inter_company_purchase_invoice from erpnext.stock.doctype.warehouse.test_warehouse import create_warehouse @@ -873,7 +871,7 @@ class TestAccountsController(IntegrationTestCase): self.assertEqual(pi.items[0].rate, arms_length_price) self.assertEqual(pi.items[0].valuation_rate, 100) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Accounts Settings", {"exchange_gain_loss_posting_date": "Reconciliation Date"} ) def test_17_gain_loss_posting_date_for_normal_payment(self): @@ -936,10 +934,7 @@ class TestAccountsController(IntegrationTestCase): self.assertEqual(exc_je_for_si, []) self.assertEqual(exc_je_for_pe, []) - @IntegrationTestCase.change_settings( - "Accounts Settings", - {"add_taxes_from_item_tax_template": 0, "add_taxes_from_taxes_and_charges_template": 1}, - ) + @ERPNextTestSuite.change_settings("Accounts Settings", {"add_taxes_from_item_tax_template": 1}) def test_18_fetch_taxes_based_on_taxes_and_charges_template(self): # Create a Sales Taxes and Charges Template if not frappe.db.exists("Sales Taxes and Charges Template", "_Test Tax - _TC"): @@ -968,7 +963,7 @@ class TestAccountsController(IntegrationTestCase): self.assertEqual(sinv.total_taxes_and_charges, 4.5) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Accounts Settings", {"add_taxes_from_item_tax_template": 1, "add_taxes_from_taxes_and_charges_template": 0}, ) @@ -2479,7 +2474,7 @@ class TestAccountsController(IntegrationTestCase): po.items[0].delivered_by_supplier = 1 po.save() - @IntegrationTestCase.change_settings("Global Defaults", {"use_posting_datetime_for_naming_documents": 1}) + @ERPNextTestSuite.change_settings("Global Defaults", {"use_posting_datetime_for_naming_documents": 1}) def test_document_naming_rule_based_on_posting_date(self): frappe.new_doc( "Document Naming Rule", document_type="Sales Invoice", prefix="SI-.MM.-.YYYY.-" diff --git a/erpnext/controllers/tests/test_distributed_discount.py b/erpnext/controllers/tests/test_distributed_discount.py index 05db1496da8..83a4dc6f3dd 100644 --- a/erpnext/controllers/tests/test_distributed_discount.py +++ b/erpnext/controllers/tests/test_distributed_discount.py @@ -1,11 +1,10 @@ -from frappe.tests import IntegrationTestCase - from erpnext.accounts.test.accounts_mixin import AccountsTestMixin from erpnext.controllers.taxes_and_totals import calculate_taxes_and_totals from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order +from erpnext.tests.utils import ERPNextTestSuite -class TestTaxesAndTotals(AccountsTestMixin, IntegrationTestCase): +class TestTaxesAndTotals(AccountsTestMixin, ERPNextTestSuite): def test_distributed_discount_amount(self): so = make_sales_order(do_not_save=1) so.apply_discount_on = "Net Total" diff --git a/erpnext/controllers/tests/test_item_variant.py b/erpnext/controllers/tests/test_item_variant.py index 585a63ca798..e5c9d05d4db 100644 --- a/erpnext/controllers/tests/test_item_variant.py +++ b/erpnext/controllers/tests/test_item_variant.py @@ -2,16 +2,16 @@ import json import unittest import frappe -from frappe.tests import IntegrationTestCase from erpnext.controllers.item_variant import copy_attributes_to_variant, make_variant_item_code from erpnext.stock.doctype.item.test_item import set_item_variant_settings from erpnext.stock.doctype.quality_inspection.test_quality_inspection import ( create_quality_inspection_parameter, ) +from erpnext.tests.utils import ERPNextTestSuite -class TestItemVariant(IntegrationTestCase): +class TestItemVariant(ERPNextTestSuite): def test_tables_in_template_copied_to_variant(self): fields = [{"field_name": "quality_inspection_template"}] set_item_variant_settings(fields) diff --git a/erpnext/controllers/tests/test_mapper.py b/erpnext/controllers/tests/test_mapper.py index fa9515e5c23..d4e10447914 100644 --- a/erpnext/controllers/tests/test_mapper.py +++ b/erpnext/controllers/tests/test_mapper.py @@ -4,11 +4,12 @@ import unittest import frappe import frappe.utils from frappe.model import mapper -from frappe.tests import IntegrationTestCase from frappe.utils import add_months, nowdate +from erpnext.tests.utils import ERPNextTestSuite -class TestMapper(IntegrationTestCase): + +class TestMapper(ERPNextTestSuite): def test_map_docs(self): """Test mapping of multiple source docs on a single target doc""" diff --git a/erpnext/controllers/tests/test_qty_based_taxes.py b/erpnext/controllers/tests/test_qty_based_taxes.py index d2fefa5b3b6..b2b3b8656a6 100644 --- a/erpnext/controllers/tests/test_qty_based_taxes.py +++ b/erpnext/controllers/tests/test_qty_based_taxes.py @@ -2,14 +2,15 @@ import unittest from uuid import uuid4 as _uuid4 import frappe -from frappe.tests import IntegrationTestCase + +from erpnext.tests.utils import ERPNextTestSuite def uuid4(): return str(_uuid4()) -class TestTaxes(IntegrationTestCase): +class TestTaxes(ERPNextTestSuite): def setUp(self): self.company = frappe.get_doc( { diff --git a/erpnext/controllers/tests/test_queries.py b/erpnext/controllers/tests/test_queries.py index 33de8114669..664841e2da2 100644 --- a/erpnext/controllers/tests/test_queries.py +++ b/erpnext/controllers/tests/test_queries.py @@ -116,7 +116,7 @@ class TestQueries(ERPNextTestSuite): } ) - with self.set_user(user.name): + with ERPNextTestSuite.set_user(user.name): params = { "doctype": "Employee", "txt": "", diff --git a/erpnext/controllers/tests/test_reactivity.py b/erpnext/controllers/tests/test_reactivity.py index b6baad2fab2..398812fa6f8 100644 --- a/erpnext/controllers/tests/test_reactivity.py +++ b/erpnext/controllers/tests/test_reactivity.py @@ -1,13 +1,13 @@ import frappe from frappe import qb -from frappe.tests import IntegrationTestCase -from frappe.utils import getdate, today +from frappe.utils import today from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import disable_dimension from erpnext.accounts.test.accounts_mixin import AccountsTestMixin +from erpnext.tests.utils import ERPNextTestSuite -class TestReactivity(AccountsTestMixin, IntegrationTestCase): +class TestReactivity(AccountsTestMixin, ERPNextTestSuite): def setUp(self): self.create_company() self.create_customer() diff --git a/erpnext/controllers/tests/test_subcontracting_controller.py b/erpnext/controllers/tests/test_subcontracting_controller.py index b6c21fa0b45..922995c0767 100644 --- a/erpnext/controllers/tests/test_subcontracting_controller.py +++ b/erpnext/controllers/tests/test_subcontracting_controller.py @@ -5,8 +5,7 @@ import copy from collections import defaultdict import frappe -from frappe.tests import IntegrationTestCase -from frappe.utils import cint +from frappe.utils import cint, flt from erpnext.buying.doctype.purchase_order.test_purchase_order import create_purchase_order from erpnext.controllers.subcontracting_controller import ( @@ -23,9 +22,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 TestSubcontractingController(IntegrationTestCase): +class TestSubcontractingController(ERPNextTestSuite): def setUp(self): make_subcontracted_items() make_raw_materials() diff --git a/erpnext/controllers/tests/test_transaction_base.py b/erpnext/controllers/tests/test_transaction_base.py index cfb2dffabb6..4d0542053f7 100644 --- a/erpnext/controllers/tests/test_transaction_base.py +++ b/erpnext/controllers/tests/test_transaction_base.py @@ -1,10 +1,11 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase + +from erpnext.tests.utils import ERPNextTestSuite -class TestUtils(IntegrationTestCase): +class TestUtils(ERPNextTestSuite): def test_reset_default_field_value(self): doc = frappe.get_doc( { diff --git a/erpnext/crm/doctype/appointment/test_appointment.py b/erpnext/crm/doctype/appointment/test_appointment.py index e88a3dc67e5..5ef79bfa4a7 100644 --- a/erpnext/crm/doctype/appointment/test_appointment.py +++ b/erpnext/crm/doctype/appointment/test_appointment.py @@ -4,7 +4,8 @@ import datetime import unittest import frappe -from frappe.tests import IntegrationTestCase + +from erpnext.tests.utils import ERPNextTestSuite LEAD_EMAIL = "test_appointment_lead@example.com" @@ -26,7 +27,7 @@ def create_test_appointment(): return test_appointment -class TestAppointment(IntegrationTestCase): +class TestAppointment(ERPNextTestSuite): @classmethod def setUpClass(cls): super().setUpClass() diff --git a/erpnext/crm/doctype/appointment_booking_settings/test_appointment_booking_settings.py b/erpnext/crm/doctype/appointment_booking_settings/test_appointment_booking_settings.py index 0fca8a59da3..96d86a224ed 100644 --- a/erpnext/crm/doctype/appointment_booking_settings/test_appointment_booking_settings.py +++ b/erpnext/crm/doctype/appointment_booking_settings/test_appointment_booking_settings.py @@ -3,8 +3,8 @@ # import frappe import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestAppointmentBookingSettings(IntegrationTestCase): +class TestAppointmentBookingSettings(ERPNextTestSuite): pass diff --git a/erpnext/crm/doctype/campaign/test_campaign.py b/erpnext/crm/doctype/campaign/test_campaign.py index 878c18664ad..b84fc2815ca 100644 --- a/erpnext/crm/doctype/campaign/test_campaign.py +++ b/erpnext/crm/doctype/campaign/test_campaign.py @@ -3,8 +3,8 @@ # import frappe import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestCampaign(IntegrationTestCase): +class TestCampaign(ERPNextTestSuite): pass diff --git a/erpnext/crm/doctype/competitor/test_competitor.py b/erpnext/crm/doctype/competitor/test_competitor.py index 2fbe068e8a7..664af74f3f6 100644 --- a/erpnext/crm/doctype/competitor/test_competitor.py +++ b/erpnext/crm/doctype/competitor/test_competitor.py @@ -3,8 +3,8 @@ # import frappe import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestCompetitor(IntegrationTestCase): +class TestCompetitor(ERPNextTestSuite): pass diff --git a/erpnext/crm/doctype/contract/test_contract.py b/erpnext/crm/doctype/contract/test_contract.py index 2ea083834ce..f6aa0ef0979 100644 --- a/erpnext/crm/doctype/contract/test_contract.py +++ b/erpnext/crm/doctype/contract/test_contract.py @@ -3,11 +3,12 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import add_days, nowdate +from erpnext.tests.utils import ERPNextTestSuite -class TestContract(IntegrationTestCase): + +class TestContract(ERPNextTestSuite): def setUp(self): frappe.db.sql("delete from `tabContract`") self.contract_doc = get_contract() diff --git a/erpnext/crm/doctype/contract_fulfilment_checklist/test_contract_fulfilment_checklist.py b/erpnext/crm/doctype/contract_fulfilment_checklist/test_contract_fulfilment_checklist.py index becb1674190..33f74f3e543 100644 --- a/erpnext/crm/doctype/contract_fulfilment_checklist/test_contract_fulfilment_checklist.py +++ b/erpnext/crm/doctype/contract_fulfilment_checklist/test_contract_fulfilment_checklist.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestContractFulfilmentChecklist(IntegrationTestCase): +class TestContractFulfilmentChecklist(ERPNextTestSuite): pass diff --git a/erpnext/crm/doctype/contract_template/test_contract_template.py b/erpnext/crm/doctype/contract_template/test_contract_template.py index 4b2911945d0..aff3c8a9171 100644 --- a/erpnext/crm/doctype/contract_template/test_contract_template.py +++ b/erpnext/crm/doctype/contract_template/test_contract_template.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestContractTemplate(IntegrationTestCase): +class TestContractTemplate(ERPNextTestSuite): pass diff --git a/erpnext/crm/doctype/crm_settings/test_crm_settings.py b/erpnext/crm/doctype/crm_settings/test_crm_settings.py index 22109d960dd..12fa43f8e1d 100644 --- a/erpnext/crm/doctype/crm_settings/test_crm_settings.py +++ b/erpnext/crm/doctype/crm_settings/test_crm_settings.py @@ -3,8 +3,8 @@ # import frappe import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestCRMSettings(IntegrationTestCase): +class TestCRMSettings(ERPNextTestSuite): pass diff --git a/erpnext/crm/doctype/email_campaign/test_email_campaign.py b/erpnext/crm/doctype/email_campaign/test_email_campaign.py index b94a41e7820..7d7d445b4be 100644 --- a/erpnext/crm/doctype/email_campaign/test_email_campaign.py +++ b/erpnext/crm/doctype/email_campaign/test_email_campaign.py @@ -3,8 +3,8 @@ # import frappe import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestEmailCampaign(IntegrationTestCase): +class TestEmailCampaign(ERPNextTestSuite): pass diff --git a/erpnext/crm/doctype/market_segment/test_market_segment.py b/erpnext/crm/doctype/market_segment/test_market_segment.py index 4f42f704309..5821bae063a 100644 --- a/erpnext/crm/doctype/market_segment/test_market_segment.py +++ b/erpnext/crm/doctype/market_segment/test_market_segment.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestMarketSegment(IntegrationTestCase): +class TestMarketSegment(ERPNextTestSuite): pass diff --git a/erpnext/crm/doctype/opportunity_type/test_opportunity_type.py b/erpnext/crm/doctype/opportunity_type/test_opportunity_type.py index 91bbd0d7095..1015ac8effa 100644 --- a/erpnext/crm/doctype/opportunity_type/test_opportunity_type.py +++ b/erpnext/crm/doctype/opportunity_type/test_opportunity_type.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestOpportunityType(IntegrationTestCase): +class TestOpportunityType(ERPNextTestSuite): pass diff --git a/erpnext/crm/doctype/prospect/test_prospect.py b/erpnext/crm/doctype/prospect/test_prospect.py index d66f3d5a494..26948fe9390 100644 --- a/erpnext/crm/doctype/prospect/test_prospect.py +++ b/erpnext/crm/doctype/prospect/test_prospect.py @@ -3,14 +3,14 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import random_string from erpnext.crm.doctype.lead.lead import add_lead_to_prospect from erpnext.crm.doctype.lead.test_lead import make_lead +from erpnext.tests.utils import ERPNextTestSuite -class TestProspect(IntegrationTestCase): +class TestProspect(ERPNextTestSuite): def test_add_lead_to_prospect_and_address_linking(self): lead_doc = make_lead() address_doc = make_address(address_title=lead_doc.name) diff --git a/erpnext/crm/doctype/sales_stage/test_sales_stage.py b/erpnext/crm/doctype/sales_stage/test_sales_stage.py index 24da6ce48f6..9633ca17c14 100644 --- a/erpnext/crm/doctype/sales_stage/test_sales_stage.py +++ b/erpnext/crm/doctype/sales_stage/test_sales_stage.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestSalesStage(IntegrationTestCase): +class TestSalesStage(ERPNextTestSuite): pass diff --git a/erpnext/crm/report/opportunity_summary_by_sales_stage/test_opportunity_summary_by_sales_stage.py b/erpnext/crm/report/opportunity_summary_by_sales_stage/test_opportunity_summary_by_sales_stage.py index 63d6cae3b00..29bc14e04e7 100644 --- a/erpnext/crm/report/opportunity_summary_by_sales_stage/test_opportunity_summary_by_sales_stage.py +++ b/erpnext/crm/report/opportunity_summary_by_sales_stage/test_opportunity_summary_by_sales_stage.py @@ -1,8 +1,3 @@ -import unittest - -import frappe -from frappe.tests import IntegrationTestCase - from erpnext.crm.report.opportunity_summary_by_sales_stage.opportunity_summary_by_sales_stage import ( execute, ) @@ -11,9 +6,10 @@ from erpnext.crm.report.sales_pipeline_analytics.test_sales_pipeline_analytics i create_customer, create_opportunity, ) +from erpnext.tests.utils import ERPNextTestSuite -class TestOpportunitySummaryBySalesStage(IntegrationTestCase): +class TestOpportunitySummaryBySalesStage(ERPNextTestSuite): @classmethod def setUpClass(cls): super().setUpClass() diff --git a/erpnext/crm/report/sales_pipeline_analytics/test_sales_pipeline_analytics.py b/erpnext/crm/report/sales_pipeline_analytics/test_sales_pipeline_analytics.py index b29668fa030..dea4b772b65 100644 --- a/erpnext/crm/report/sales_pipeline_analytics/test_sales_pipeline_analytics.py +++ b/erpnext/crm/report/sales_pipeline_analytics/test_sales_pipeline_analytics.py @@ -1,12 +1,12 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from erpnext.crm.report.sales_pipeline_analytics.sales_pipeline_analytics import execute +from erpnext.tests.utils import ERPNextTestSuite -class TestSalesPipelineAnalytics(IntegrationTestCase): +class TestSalesPipelineAnalytics(ERPNextTestSuite): def setUp(self): create_company() create_customer() diff --git a/erpnext/erpnext_integrations/doctype/plaid_settings/test_plaid_settings.py b/erpnext/erpnext_integrations/doctype/plaid_settings/test_plaid_settings.py index 891a6bd10df..4e3f3056629 100644 --- a/erpnext/erpnext_integrations/doctype/plaid_settings/test_plaid_settings.py +++ b/erpnext/erpnext_integrations/doctype/plaid_settings/test_plaid_settings.py @@ -4,7 +4,6 @@ import json import unittest import frappe -from frappe.tests import IntegrationTestCase from frappe.utils.response import json_handler from erpnext.erpnext_integrations.doctype.plaid_settings.plaid_settings import ( @@ -14,9 +13,10 @@ from erpnext.erpnext_integrations.doctype.plaid_settings.plaid_settings import ( get_plaid_configuration, new_bank_transaction, ) +from erpnext.tests.utils import ERPNextTestSuite -class TestPlaidSettings(IntegrationTestCase): +class TestPlaidSettings(ERPNextTestSuite): def setUp(self): pass diff --git a/erpnext/maintenance/doctype/maintenance_schedule/test_maintenance_schedule.py b/erpnext/maintenance/doctype/maintenance_schedule/test_maintenance_schedule.py index 206c9687c31..6ff2d7cb239 100644 --- a/erpnext/maintenance/doctype/maintenance_schedule/test_maintenance_schedule.py +++ b/erpnext/maintenance/doctype/maintenance_schedule/test_maintenance_schedule.py @@ -3,7 +3,6 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import format_date from frappe.utils.data import add_days, formatdate, today @@ -13,9 +12,10 @@ from erpnext.maintenance.doctype.maintenance_schedule.maintenance_schedule impor ) from erpnext.stock.doctype.item.test_item import create_item from erpnext.stock.doctype.stock_entry.test_stock_entry import make_serialized_item +from erpnext.tests.utils import ERPNextTestSuite -class TestMaintenanceSchedule(IntegrationTestCase): +class TestMaintenanceSchedule(ERPNextTestSuite): @classmethod def setUpClass(cls): super().setUpClass() diff --git a/erpnext/maintenance/doctype/maintenance_visit/test_maintenance_visit.py b/erpnext/maintenance/doctype/maintenance_visit/test_maintenance_visit.py index 51a27983269..ffc49296a4c 100644 --- a/erpnext/maintenance/doctype/maintenance_visit/test_maintenance_visit.py +++ b/erpnext/maintenance/doctype/maintenance_visit/test_maintenance_visit.py @@ -3,11 +3,12 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from frappe.utils.data import today +from erpnext.tests.utils import ERPNextTestSuite -class TestMaintenanceVisit(IntegrationTestCase): + +class TestMaintenanceVisit(ERPNextTestSuite): pass diff --git a/erpnext/manufacturing/doctype/blanket_order/test_blanket_order.py b/erpnext/manufacturing/doctype/blanket_order/test_blanket_order.py index 169197e04ca..ac7c860dd1b 100644 --- a/erpnext/manufacturing/doctype/blanket_order/test_blanket_order.py +++ b/erpnext/manufacturing/doctype/blanket_order/test_blanket_order.py @@ -1,16 +1,16 @@ # Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import add_months, today from erpnext import get_company_currency from erpnext.stock.doctype.item.test_item import make_item +from erpnext.tests.utils import ERPNextTestSuite from .blanket_order import make_order -class TestBlanketOrder(IntegrationTestCase): +class TestBlanketOrder(ERPNextTestSuite): def setUp(self): frappe.flags.args = frappe._dict() diff --git a/erpnext/manufacturing/doctype/bom/test_bom.py b/erpnext/manufacturing/doctype/bom/test_bom.py index a6963a66254..4c7ab8dc7ca 100644 --- a/erpnext/manufacturing/doctype/bom/test_bom.py +++ b/erpnext/manufacturing/doctype/bom/test_bom.py @@ -6,7 +6,7 @@ from collections import deque from functools import partial import frappe -from frappe.tests import IntegrationTestCase, timeout +from frappe.tests import timeout from frappe.utils import cstr, flt from erpnext.controllers.tests.test_subcontracting_controller import ( @@ -20,9 +20,10 @@ from erpnext.stock.doctype.item.test_item import make_item from erpnext.stock.doctype.stock_reconciliation.test_stock_reconciliation import ( create_stock_reconciliation, ) +from erpnext.tests.utils import ERPNextTestSuite -class TestBOM(IntegrationTestCase): +class TestBOM(ERPNextTestSuite): @timeout def test_get_items(self): from erpnext.manufacturing.doctype.bom.bom import get_bom_items_as_dict diff --git a/erpnext/manufacturing/doctype/bom_creator/test_bom_creator.py b/erpnext/manufacturing/doctype/bom_creator/test_bom_creator.py index b277ca3c483..f7e7623b471 100644 --- a/erpnext/manufacturing/doctype/bom_creator/test_bom_creator.py +++ b/erpnext/manufacturing/doctype/bom_creator/test_bom_creator.py @@ -4,16 +4,16 @@ import random import frappe -from frappe.tests import IntegrationTestCase from erpnext.manufacturing.doctype.bom_creator.bom_creator import ( add_item, add_sub_assembly, ) from erpnext.stock.doctype.item.test_item import make_item +from erpnext.tests.utils import ERPNextTestSuite -class TestBOMCreator(IntegrationTestCase): +class TestBOMCreator(ERPNextTestSuite): def setUp(self) -> None: create_items() diff --git a/erpnext/manufacturing/doctype/bom_update_log/test_bom_update_log.py b/erpnext/manufacturing/doctype/bom_update_log/test_bom_update_log.py index 7b8b89a4c14..4d60506ca5e 100644 --- a/erpnext/manufacturing/doctype/bom_update_log/test_bom_update_log.py +++ b/erpnext/manufacturing/doctype/bom_update_log/test_bom_update_log.py @@ -2,7 +2,6 @@ # See license.txt import frappe -from frappe.tests import IntegrationTestCase from erpnext.manufacturing.doctype.bom_update_log.bom_update_log import ( BOMMissingError, @@ -12,10 +11,10 @@ from erpnext.manufacturing.doctype.bom_update_tool.bom_update_tool import ( enqueue_replace_bom, enqueue_update_cost, ) +from erpnext.tests.utils import ERPNextTestSuite - -class TestBOMUpdateLog(IntegrationTestCase): +class TestBOMUpdateLog(ERPNextTestSuite): "Test BOM Update Tool Operations via BOM Update Log." def setUp(self): diff --git a/erpnext/manufacturing/doctype/bom_update_tool/test_bom_update_tool.py b/erpnext/manufacturing/doctype/bom_update_tool/test_bom_update_tool.py index 0da15a0bc38..eec6db620da 100644 --- a/erpnext/manufacturing/doctype/bom_update_tool/test_bom_update_tool.py +++ b/erpnext/manufacturing/doctype/bom_update_tool/test_bom_update_tool.py @@ -2,7 +2,7 @@ # License: GNU General Public License v3. See license.txt import frappe -from frappe.tests import IntegrationTestCase, timeout +from frappe.tests import timeout from erpnext.manufacturing.doctype.bom_update_log.test_bom_update_log import ( update_cost_in_all_boms_in_test, @@ -10,10 +10,10 @@ from erpnext.manufacturing.doctype.bom_update_log.test_bom_update_log import ( from erpnext.manufacturing.doctype.bom_update_tool.bom_update_tool import enqueue_replace_bom from erpnext.manufacturing.doctype.production_plan.test_production_plan import make_bom from erpnext.stock.doctype.item.test_item import create_item +from erpnext.tests.utils import ERPNextTestSuite - -class TestBOMUpdateTool(IntegrationTestCase): +class TestBOMUpdateTool(ERPNextTestSuite): "Test major functions run via BOM Update Tool." def tearDown(self): diff --git a/erpnext/manufacturing/doctype/downtime_entry/test_downtime_entry.py b/erpnext/manufacturing/doctype/downtime_entry/test_downtime_entry.py index b59b336c657..88fcade6920 100644 --- a/erpnext/manufacturing/doctype/downtime_entry/test_downtime_entry.py +++ b/erpnext/manufacturing/doctype/downtime_entry/test_downtime_entry.py @@ -3,8 +3,8 @@ # import frappe import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestDowntimeEntry(IntegrationTestCase): +class TestDowntimeEntry(ERPNextTestSuite): pass diff --git a/erpnext/manufacturing/doctype/job_card/test_job_card.py b/erpnext/manufacturing/doctype/job_card/test_job_card.py index 70ffc232e21..d44f6a0d9e5 100644 --- a/erpnext/manufacturing/doctype/job_card/test_job_card.py +++ b/erpnext/manufacturing/doctype/job_card/test_job_card.py @@ -5,8 +5,7 @@ from typing import Literal import frappe -from frappe.tests import IntegrationTestCase -from frappe.utils import random_string +from frappe.utils import flt, random_string from frappe.utils.data import add_to_date, now, today from erpnext.manufacturing.doctype.job_card.job_card import ( @@ -282,7 +281,7 @@ class TestJobCard(ERPNextTestSuite): # transfer was made for 2 fg qty in first transfer Stock Entry self.assertEqual(transfer_entry_2.fg_completed_qty, 0) - @IntegrationTestCase.change_settings("Manufacturing Settings", {"job_card_excess_transfer": 1}) + @ERPNextTestSuite.change_settings("Manufacturing Settings", {"job_card_excess_transfer": 1}) def test_job_card_excess_material_transfer(self): "Test transferring more than required RM against Job Card." self.transfer_material_against = "Job Card" @@ -325,7 +324,7 @@ class TestJobCard(ERPNextTestSuite): # JC is Completed with excess transfer self.assertEqual(job_card.status, "Completed") - @IntegrationTestCase.change_settings("Manufacturing Settings", {"job_card_excess_transfer": 0}) + @ERPNextTestSuite.change_settings("Manufacturing Settings", {"job_card_excess_transfer": 0}) def test_job_card_excess_material_transfer_block(self): self.transfer_material_against = "Job Card" self.source_warehouse = "Stores - _TC" @@ -348,7 +347,7 @@ class TestJobCard(ERPNextTestSuite): transfer_entry_2.insert() self.assertRaises(JobCardOverTransferError, transfer_entry_2.submit) - @IntegrationTestCase.change_settings("Manufacturing Settings", {"job_card_excess_transfer": 0}) + @ERPNextTestSuite.change_settings("Manufacturing Settings", {"job_card_excess_transfer": 0}) def test_job_card_excess_material_transfer_with_no_reference(self): self.transfer_material_against = "Job Card" self.source_warehouse = "Stores - _TC" @@ -456,7 +455,7 @@ class TestJobCard(ERPNextTestSuite): self.assertEqual(transfer_entry.items[0].item_code, "_Test Item") self.assertEqual(transfer_entry.items[0].qty, 2) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Manufacturing Settings", {"add_corrective_operation_cost_in_finished_good_valuation": 1} ) def test_corrective_costing(self): @@ -500,7 +499,7 @@ class TestJobCard(ERPNextTestSuite): cost_after_cancel = self.work_order.total_operating_cost self.assertEqual(cost_after_cancel, original_cost) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Manufacturing Settings", {"add_corrective_operation_cost_in_finished_good_valuation": 1} ) def test_if_corrective_jc_ops_cost_is_added_to_manufacture_stock_entry(self): diff --git a/erpnext/manufacturing/doctype/manufacturing_settings/test_manufacturing_settings.py b/erpnext/manufacturing/doctype/manufacturing_settings/test_manufacturing_settings.py index 050b5d7d0f2..a9661480b95 100644 --- a/erpnext/manufacturing/doctype/manufacturing_settings/test_manufacturing_settings.py +++ b/erpnext/manufacturing/doctype/manufacturing_settings/test_manufacturing_settings.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestManufacturingSettings(IntegrationTestCase): +class TestManufacturingSettings(ERPNextTestSuite): pass diff --git a/erpnext/manufacturing/doctype/material_request_plan_item/test_material_request_plan_item.py b/erpnext/manufacturing/doctype/material_request_plan_item/test_material_request_plan_item.py index f903d2dce2d..ee7bb6ec0b2 100644 --- a/erpnext/manufacturing/doctype/material_request_plan_item/test_material_request_plan_item.py +++ b/erpnext/manufacturing/doctype/material_request_plan_item/test_material_request_plan_item.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestMaterialRequestPlanItem(IntegrationTestCase): +class TestMaterialRequestPlanItem(ERPNextTestSuite): pass diff --git a/erpnext/manufacturing/doctype/operation/test_operation.py b/erpnext/manufacturing/doctype/operation/test_operation.py index d9867e74557..e00b85d7e94 100644 --- a/erpnext/manufacturing/doctype/operation/test_operation.py +++ b/erpnext/manufacturing/doctype/operation/test_operation.py @@ -3,10 +3,11 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase + +from erpnext.tests.utils import ERPNextTestSuite -class TestOperation(IntegrationTestCase): +class TestOperation(ERPNextTestSuite): pass diff --git a/erpnext/manufacturing/doctype/plant_floor/test_plant_floor.py b/erpnext/manufacturing/doctype/plant_floor/test_plant_floor.py index 78a8662e1fc..c2cbd97d0d1 100644 --- a/erpnext/manufacturing/doctype/plant_floor/test_plant_floor.py +++ b/erpnext/manufacturing/doctype/plant_floor/test_plant_floor.py @@ -2,8 +2,10 @@ # See license.txt # import frappe -from frappe.tests import IntegrationTestCase -class TestPlantFloor(IntegrationTestCase): +from erpnext.tests.utils import ERPNextTestSuite + + +class TestPlantFloor(ERPNextTestSuite): pass diff --git a/erpnext/manufacturing/doctype/production_plan/test_production_plan.py b/erpnext/manufacturing/doctype/production_plan/test_production_plan.py index 08249de49fb..ba51ba5c5d0 100644 --- a/erpnext/manufacturing/doctype/production_plan/test_production_plan.py +++ b/erpnext/manufacturing/doctype/production_plan/test_production_plan.py @@ -1,7 +1,6 @@ # Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import add_to_date, flt, getdate, now_datetime, nowdate from erpnext.controllers.item_variant import create_variant @@ -25,9 +24,10 @@ from erpnext.stock.doctype.stock_reconciliation.test_stock_reconciliation import create_stock_reconciliation, ) from erpnext.stock.doctype.stock_reservation_entry.stock_reservation_entry import StockReservation +from erpnext.tests.utils import ERPNextTestSuite -class TestProductionPlan(IntegrationTestCase): +class TestProductionPlan(ERPNextTestSuite): def setUp(self): for item in [ "Test Production Item 1", diff --git a/erpnext/manufacturing/doctype/production_plan_material_request_warehouse/test_production_plan_material_request_warehouse.py b/erpnext/manufacturing/doctype/production_plan_material_request_warehouse/test_production_plan_material_request_warehouse.py index bab30fa6a92..01a3465156c 100644 --- a/erpnext/manufacturing/doctype/production_plan_material_request_warehouse/test_production_plan_material_request_warehouse.py +++ b/erpnext/manufacturing/doctype/production_plan_material_request_warehouse/test_production_plan_material_request_warehouse.py @@ -3,8 +3,8 @@ # import frappe import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestProductionPlanMaterialRequestWarehouse(IntegrationTestCase): +class TestProductionPlanMaterialRequestWarehouse(ERPNextTestSuite): pass diff --git a/erpnext/manufacturing/doctype/routing/test_routing.py b/erpnext/manufacturing/doctype/routing/test_routing.py index 114297cc9c8..0c53096f6a8 100644 --- a/erpnext/manufacturing/doctype/routing/test_routing.py +++ b/erpnext/manufacturing/doctype/routing/test_routing.py @@ -1,14 +1,14 @@ # Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt import frappe -from frappe.tests import IntegrationTestCase from erpnext.manufacturing.doctype.job_card.job_card import OperationSequenceError from erpnext.manufacturing.doctype.work_order.test_work_order import make_wo_order_test_record from erpnext.stock.doctype.item.test_item import make_item +from erpnext.tests.utils import ERPNextTestSuite -class TestRouting(IntegrationTestCase): +class TestRouting(ERPNextTestSuite): @classmethod def setUpClass(cls): super().setUpClass() diff --git a/erpnext/manufacturing/doctype/sub_operation/test_sub_operation.py b/erpnext/manufacturing/doctype/sub_operation/test_sub_operation.py index 05486e98777..45a79e974ca 100644 --- a/erpnext/manufacturing/doctype/sub_operation/test_sub_operation.py +++ b/erpnext/manufacturing/doctype/sub_operation/test_sub_operation.py @@ -3,8 +3,8 @@ # import frappe import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestSubOperation(IntegrationTestCase): +class TestSubOperation(ERPNextTestSuite): pass diff --git a/erpnext/manufacturing/doctype/work_order/test_work_order.py b/erpnext/manufacturing/doctype/work_order/test_work_order.py index 2a2beaa87bb..01d2e954075 100644 --- a/erpnext/manufacturing/doctype/work_order/test_work_order.py +++ b/erpnext/manufacturing/doctype/work_order/test_work_order.py @@ -5,7 +5,7 @@ from collections import defaultdict import frappe -from frappe.tests import IntegrationTestCase, timeout +from frappe.tests import timeout from frappe.utils import add_days, add_months, add_to_date, cint, flt, now, today from erpnext.manufacturing.doctype.job_card.job_card import JobCardCancelError @@ -33,9 +33,10 @@ from erpnext.stock.doctype.serial_no.serial_no import get_serial_nos from erpnext.stock.doctype.stock_entry import test_stock_entry from erpnext.stock.doctype.warehouse.test_warehouse import create_warehouse from erpnext.stock.utils import get_bin +from erpnext.tests.utils import ERPNextTestSuite -class TestWorkOrder(IntegrationTestCase): +class TestWorkOrder(ERPNextTestSuite): def setUp(self): self.warehouse = "_Test Warehouse 2 - _TC" self.item = "_Test Item" @@ -1233,9 +1234,7 @@ class TestWorkOrder(IntegrationTestCase): frappe.db.set_single_value("Manufacturing Settings", "backflush_raw_materials_based_on", "BOM") - @IntegrationTestCase.change_settings( - "Manufacturing Settings", {"make_serial_no_batch_from_work_order": 1} - ) + @ERPNextTestSuite.change_settings("Manufacturing Settings", {"make_serial_no_batch_from_work_order": 1}) def test_auto_batch_creation(self): from erpnext.manufacturing.doctype.bom.test_bom import create_nested_bom @@ -1256,9 +1255,7 @@ class TestWorkOrder(IntegrationTestCase): except frappe.MandatoryError: self.fail("Batch generation causing failing in Work Order") - @IntegrationTestCase.change_settings( - "Manufacturing Settings", {"make_serial_no_batch_from_work_order": 1} - ) + @ERPNextTestSuite.change_settings("Manufacturing Settings", {"make_serial_no_batch_from_work_order": 1}) def test_auto_serial_no_creation(self): from erpnext.manufacturing.doctype.bom.test_bom import create_nested_bom @@ -1291,9 +1288,7 @@ class TestWorkOrder(IntegrationTestCase): except frappe.MandatoryError: self.fail("Batch generation causing failing in Work Order") - @IntegrationTestCase.change_settings( - "Manufacturing Settings", {"make_serial_no_batch_from_work_order": 1} - ) + @ERPNextTestSuite.change_settings("Manufacturing Settings", {"make_serial_no_batch_from_work_order": 1}) def test_auto_serial_no_batch_creation(self): from erpnext.manufacturing.doctype.bom.test_bom import create_nested_bom @@ -1345,7 +1340,7 @@ class TestWorkOrder(IntegrationTestCase): return serial_nos - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Manufacturing Settings", {"backflush_raw_materials_based_on": "Material Transferred for Manufacture"}, ) @@ -1375,7 +1370,7 @@ class TestWorkOrder(IntegrationTestCase): for index, row in enumerate(ste_manu.get("items"), start=1): self.assertEqual(index, row.idx) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Manufacturing Settings", {"backflush_raw_materials_based_on": "Material Transferred for Manufacture"}, ) @@ -2159,7 +2154,7 @@ class TestWorkOrder(IntegrationTestCase): frappe.db.set_single_value("Manufacturing Settings", "set_op_cost_and_scrap_from_sub_assemblies", 0) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Manufacturing Settings", {"material_consumption": 1, "get_rm_cost_from_consumption_entry": 1} ) def test_get_rm_cost_from_consumption_entry(self): diff --git a/erpnext/manufacturing/doctype/workstation/test_workstation.py b/erpnext/manufacturing/doctype/workstation/test_workstation.py index 9222b478d33..424e467e39f 100644 --- a/erpnext/manufacturing/doctype/workstation/test_workstation.py +++ b/erpnext/manufacturing/doctype/workstation/test_workstation.py @@ -2,7 +2,6 @@ # See license.txt import frappe from frappe import _ -from frappe.tests import IntegrationTestCase from erpnext.manufacturing.doctype.operation.test_operation import make_operation from erpnext.manufacturing.doctype.routing.test_routing import create_routing, setup_bom @@ -11,9 +10,10 @@ from erpnext.manufacturing.doctype.workstation.workstation import ( WorkstationHolidayError, check_if_within_operating_hours, ) +from erpnext.tests.utils import ERPNextTestSuite -class TestWorkstation(IntegrationTestCase): +class TestWorkstation(ERPNextTestSuite): def test_validate_timings(self): check_if_within_operating_hours( "_Test Workstation 1", "Operation 1", "2013-02-02 11:00:00", "2013-02-02 19:00:00" diff --git a/erpnext/manufacturing/doctype/workstation_type/test_workstation_type.py b/erpnext/manufacturing/doctype/workstation_type/test_workstation_type.py index 7e62d4c4ffe..98461a72c98 100644 --- a/erpnext/manufacturing/doctype/workstation_type/test_workstation_type.py +++ b/erpnext/manufacturing/doctype/workstation_type/test_workstation_type.py @@ -2,10 +2,11 @@ # See license.txt import frappe -from frappe.tests import IntegrationTestCase + +from erpnext.tests.utils import ERPNextTestSuite -class TestWorkstationType(IntegrationTestCase): +class TestWorkstationType(ERPNextTestSuite): pass diff --git a/erpnext/manufacturing/report/bom_stock_calculated/test_bom_stock_calculated.py b/erpnext/manufacturing/report/bom_stock_calculated/test_bom_stock_calculated.py index 6bbbacbeb77..37642da0680 100644 --- a/erpnext/manufacturing/report/bom_stock_calculated/test_bom_stock_calculated.py +++ b/erpnext/manufacturing/report/bom_stock_calculated/test_bom_stock_calculated.py @@ -1,16 +1,15 @@ # Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and contributors # For license information, please see license.txt -from frappe.tests import IntegrationTestCase - from erpnext.manufacturing.doctype.production_plan.test_production_plan import make_bom from erpnext.manufacturing.report.bom_stock_calculated.bom_stock_calculated import ( execute as bom_stock_calculated_report, ) from erpnext.stock.doctype.item.test_item import make_item +from erpnext.tests.utils import ERPNextTestSuite -class TestBOMStockCalculated(IntegrationTestCase): +class TestBOMStockCalculated(ERPNextTestSuite): def setUp(self): self.fg_item, self.rm_items = create_items() self.boms = create_boms(self.fg_item, self.rm_items) diff --git a/erpnext/manufacturing/report/bom_stock_report/test_bom_stock_report.py b/erpnext/manufacturing/report/bom_stock_report/test_bom_stock_report.py index 2bcb43b409f..43706fcb4de 100644 --- a/erpnext/manufacturing/report/bom_stock_report/test_bom_stock_report.py +++ b/erpnext/manufacturing/report/bom_stock_report/test_bom_stock_report.py @@ -4,7 +4,6 @@ import frappe from frappe.exceptions import ValidationError -from frappe.tests import IntegrationTestCase from frappe.utils import floor from erpnext.manufacturing.doctype.production_plan.test_production_plan import make_bom @@ -13,9 +12,10 @@ from erpnext.manufacturing.report.bom_stock_report.bom_stock_report import ( ) from erpnext.stock.doctype.item.test_item import make_item from erpnext.stock.doctype.stock_entry.test_stock_entry import make_stock_entry +from erpnext.tests.utils import ERPNextTestSuite -class TestBomStockReport(IntegrationTestCase): +class TestBomStockReport(ERPNextTestSuite): def setUp(self): self.warehouse = "_Test Warehouse - _TC" self.fg_item, self.rm_items = create_items() diff --git a/erpnext/manufacturing/report/test_reports.py b/erpnext/manufacturing/report/test_reports.py index 8e53d9064de..163a91c7ef9 100644 --- a/erpnext/manufacturing/report/test_reports.py +++ b/erpnext/manufacturing/report/test_reports.py @@ -1,12 +1,11 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase -from erpnext.tests.utils import ReportFilters, ReportName, execute_script_report +from erpnext.tests.utils import ERPNextTestSuite, ReportFilters, ReportName, execute_script_report -class TestManufacturingReports(IntegrationTestCase): +class TestManufacturingReports(ERPNextTestSuite): def setUp(self): self.setup_default_filters() diff --git a/erpnext/projects/doctype/project_template/test_project_template.py b/erpnext/projects/doctype/project_template/test_project_template.py index 2671d7a02ec..72ccbbfad70 100644 --- a/erpnext/projects/doctype/project_template/test_project_template.py +++ b/erpnext/projects/doctype/project_template/test_project_template.py @@ -3,12 +3,12 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from erpnext.projects.doctype.task.test_task import create_task +from erpnext.tests.utils import ERPNextTestSuite -class TestProjectTemplate(IntegrationTestCase): +class TestProjectTemplate(ERPNextTestSuite): pass diff --git a/erpnext/projects/doctype/project_type/test_project_type.py b/erpnext/projects/doctype/project_type/test_project_type.py index 31e0f840db3..51038e61c06 100644 --- a/erpnext/projects/doctype/project_type/test_project_type.py +++ b/erpnext/projects/doctype/project_type/test_project_type.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestProjectType(IntegrationTestCase): +class TestProjectType(ERPNextTestSuite): pass diff --git a/erpnext/projects/doctype/project_update/test_project_update.py b/erpnext/projects/doctype/project_update/test_project_update.py index 51f0ce14ac9..5a64a32706a 100644 --- a/erpnext/projects/doctype/project_update/test_project_update.py +++ b/erpnext/projects/doctype/project_update/test_project_update.py @@ -2,9 +2,8 @@ # See license.txt import unittest -import frappe -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestProjectUpdate(IntegrationTestCase): +class TestProjectUpdate(ERPNextTestSuite): pass diff --git a/erpnext/projects/doctype/projects_settings/test_projects_settings.py b/erpnext/projects/doctype/projects_settings/test_projects_settings.py index 06ecd2ad5dd..55878f54f73 100644 --- a/erpnext/projects/doctype/projects_settings/test_projects_settings.py +++ b/erpnext/projects/doctype/projects_settings/test_projects_settings.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestProjectsSettings(IntegrationTestCase): +class TestProjectsSettings(ERPNextTestSuite): pass diff --git a/erpnext/projects/doctype/task_type/test_task_type.py b/erpnext/projects/doctype/task_type/test_task_type.py index 9f34e97592e..de544f1b007 100644 --- a/erpnext/projects/doctype/task_type/test_task_type.py +++ b/erpnext/projects/doctype/task_type/test_task_type.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestTaskType(IntegrationTestCase): +class TestTaskType(ERPNextTestSuite): pass diff --git a/erpnext/projects/doctype/timesheet/test_timesheet.py b/erpnext/projects/doctype/timesheet/test_timesheet.py index c1f6e8d5dd9..0526f8733de 100644 --- a/erpnext/projects/doctype/timesheet/test_timesheet.py +++ b/erpnext/projects/doctype/timesheet/test_timesheet.py @@ -4,7 +4,6 @@ import datetime import unittest import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import add_to_date, now_datetime, nowdate from erpnext.accounts.doctype.sales_invoice.sales_invoice import make_sales_return @@ -119,7 +118,7 @@ class TestTimesheet(ERPNextTestSuite): self.assertEqual(item.qty, 2.00) self.assertEqual(item.rate, 50.00) - @IntegrationTestCase.change_settings("Projects Settings", {"fetch_timesheet_in_sales_invoice": 1}) + @ERPNextTestSuite.change_settings("Projects Settings", {"fetch_timesheet_in_sales_invoice": 1}) def test_timesheet_billing_based_on_project(self): emp = make_employee("test_employee_6@salary.com") project = frappe.get_value("Project", {"project_name": "_Test Project"}) diff --git a/erpnext/projects/report/delayed_tasks_summary/test_delayed_tasks_summary.py b/erpnext/projects/report/delayed_tasks_summary/test_delayed_tasks_summary.py index 20c74ef5e80..4f247ee5df3 100644 --- a/erpnext/projects/report/delayed_tasks_summary/test_delayed_tasks_summary.py +++ b/erpnext/projects/report/delayed_tasks_summary/test_delayed_tasks_summary.py @@ -1,14 +1,14 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import add_days, add_months, nowdate from erpnext.projects.doctype.task.test_task import create_task from erpnext.projects.report.delayed_tasks_summary.delayed_tasks_summary import execute +from erpnext.tests.utils import ERPNextTestSuite -class TestDelayedTasksSummary(IntegrationTestCase): +class TestDelayedTasksSummary(ERPNextTestSuite): @classmethod def setUp(self): task1 = create_task("_Test Task 98", add_days(nowdate(), -10), nowdate()) diff --git a/erpnext/quality_management/doctype/non_conformance/test_non_conformance.py b/erpnext/quality_management/doctype/non_conformance/test_non_conformance.py index 68b6536cc18..ea764a7b81d 100644 --- a/erpnext/quality_management/doctype/non_conformance/test_non_conformance.py +++ b/erpnext/quality_management/doctype/non_conformance/test_non_conformance.py @@ -3,8 +3,8 @@ # import frappe import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestNonConformance(IntegrationTestCase): +class TestNonConformance(ERPNextTestSuite): pass diff --git a/erpnext/quality_management/doctype/quality_action/test_quality_action.py b/erpnext/quality_management/doctype/quality_action/test_quality_action.py index 1e1dfc376bc..9cd28e7c2e6 100644 --- a/erpnext/quality_management/doctype/quality_action/test_quality_action.py +++ b/erpnext/quality_management/doctype/quality_action/test_quality_action.py @@ -2,9 +2,9 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestQualityAction(IntegrationTestCase): +class TestQualityAction(ERPNextTestSuite): # quality action has no code pass diff --git a/erpnext/quality_management/doctype/quality_feedback/test_quality_feedback.py b/erpnext/quality_management/doctype/quality_feedback/test_quality_feedback.py index 35a326ad943..310e4789a94 100644 --- a/erpnext/quality_management/doctype/quality_feedback/test_quality_feedback.py +++ b/erpnext/quality_management/doctype/quality_feedback/test_quality_feedback.py @@ -3,10 +3,11 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase + +from erpnext.tests.utils import ERPNextTestSuite -class TestQualityFeedback(IntegrationTestCase): +class TestQualityFeedback(ERPNextTestSuite): def test_quality_feedback(self): template = frappe.get_doc( doctype="Quality Feedback Template", diff --git a/erpnext/quality_management/doctype/quality_feedback_template/test_quality_feedback_template.py b/erpnext/quality_management/doctype/quality_feedback_template/test_quality_feedback_template.py index 2064bbc5513..ec4c4c2b922 100644 --- a/erpnext/quality_management/doctype/quality_feedback_template/test_quality_feedback_template.py +++ b/erpnext/quality_management/doctype/quality_feedback_template/test_quality_feedback_template.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestQualityFeedbackTemplate(IntegrationTestCase): +class TestQualityFeedbackTemplate(ERPNextTestSuite): pass diff --git a/erpnext/quality_management/doctype/quality_goal/test_quality_goal.py b/erpnext/quality_management/doctype/quality_goal/test_quality_goal.py index 57d0a94ed0a..7a4bfc7d864 100644 --- a/erpnext/quality_management/doctype/quality_goal/test_quality_goal.py +++ b/erpnext/quality_management/doctype/quality_goal/test_quality_goal.py @@ -3,10 +3,11 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase + +from erpnext.tests.utils import ERPNextTestSuite -class TestQualityGoal(IntegrationTestCase): +class TestQualityGoal(ERPNextTestSuite): def test_quality_goal(self): # no code, just a basic sanity check goal = get_quality_goal() diff --git a/erpnext/quality_management/doctype/quality_meeting/test_quality_meeting.py b/erpnext/quality_management/doctype/quality_meeting/test_quality_meeting.py index e0ff7d77f24..7ac01008f66 100644 --- a/erpnext/quality_management/doctype/quality_meeting/test_quality_meeting.py +++ b/erpnext/quality_management/doctype/quality_meeting/test_quality_meeting.py @@ -2,9 +2,9 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestQualityMeeting(IntegrationTestCase): +class TestQualityMeeting(ERPNextTestSuite): # nothing to test pass diff --git a/erpnext/quality_management/doctype/quality_meeting_agenda/test_quality_meeting_agenda.py b/erpnext/quality_management/doctype/quality_meeting_agenda/test_quality_meeting_agenda.py index e83a3e394e1..cca2b7d6267 100644 --- a/erpnext/quality_management/doctype/quality_meeting_agenda/test_quality_meeting_agenda.py +++ b/erpnext/quality_management/doctype/quality_meeting_agenda/test_quality_meeting_agenda.py @@ -3,8 +3,8 @@ # import frappe import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestQualityMeetingAgenda(IntegrationTestCase): +class TestQualityMeetingAgenda(ERPNextTestSuite): pass diff --git a/erpnext/quality_management/doctype/quality_procedure/test_quality_procedure.py b/erpnext/quality_management/doctype/quality_procedure/test_quality_procedure.py index 64022ec4c37..e4d847159f6 100644 --- a/erpnext/quality_management/doctype/quality_procedure/test_quality_procedure.py +++ b/erpnext/quality_management/doctype/quality_procedure/test_quality_procedure.py @@ -2,12 +2,13 @@ # See license.txt import frappe -from frappe.tests import IntegrationTestCase + +from erpnext.tests.utils import ERPNextTestSuite from .quality_procedure import add_node -class TestQualityProcedure(IntegrationTestCase): +class TestQualityProcedure(ERPNextTestSuite): def test_add_node(self): procedure = create_procedure( { diff --git a/erpnext/quality_management/doctype/quality_review/test_quality_review.py b/erpnext/quality_management/doctype/quality_review/test_quality_review.py index a3c78c5a416..fd550762ccf 100644 --- a/erpnext/quality_management/doctype/quality_review/test_quality_review.py +++ b/erpnext/quality_management/doctype/quality_review/test_quality_review.py @@ -3,13 +3,14 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase + +from erpnext.tests.utils import ERPNextTestSuite from ..quality_goal.test_quality_goal import get_quality_goal from .quality_review import review -class TestQualityReview(IntegrationTestCase): +class TestQualityReview(ERPNextTestSuite): def test_review_creation(self): quality_goal = get_quality_goal() review() diff --git a/erpnext/regional/doctype/import_supplier_invoice/test_import_supplier_invoice.py b/erpnext/regional/doctype/import_supplier_invoice/test_import_supplier_invoice.py index 7d512dbfb55..07005ee1b60 100644 --- a/erpnext/regional/doctype/import_supplier_invoice/test_import_supplier_invoice.py +++ b/erpnext/regional/doctype/import_supplier_invoice/test_import_supplier_invoice.py @@ -3,8 +3,8 @@ # import frappe import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestImportSupplierInvoice(IntegrationTestCase): +class TestImportSupplierInvoice(ERPNextTestSuite): pass diff --git a/erpnext/regional/doctype/lower_deduction_certificate/test_lower_deduction_certificate.py b/erpnext/regional/doctype/lower_deduction_certificate/test_lower_deduction_certificate.py index f6ceb56557b..58b874c0880 100644 --- a/erpnext/regional/doctype/lower_deduction_certificate/test_lower_deduction_certificate.py +++ b/erpnext/regional/doctype/lower_deduction_certificate/test_lower_deduction_certificate.py @@ -3,8 +3,8 @@ # import frappe import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestLowerDeductionCertificate(IntegrationTestCase): +class TestLowerDeductionCertificate(ERPNextTestSuite): pass diff --git a/erpnext/regional/doctype/south_africa_vat_settings/test_south_africa_vat_settings.py b/erpnext/regional/doctype/south_africa_vat_settings/test_south_africa_vat_settings.py index 9ed34764f70..0bb509a430a 100644 --- a/erpnext/regional/doctype/south_africa_vat_settings/test_south_africa_vat_settings.py +++ b/erpnext/regional/doctype/south_africa_vat_settings/test_south_africa_vat_settings.py @@ -3,8 +3,8 @@ # import frappe import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestSouthAfricaVATSettings(IntegrationTestCase): +class TestSouthAfricaVATSettings(ERPNextTestSuite): pass diff --git a/erpnext/regional/doctype/uae_vat_settings/test_uae_vat_settings.py b/erpnext/regional/doctype/uae_vat_settings/test_uae_vat_settings.py index 8d21d08b798..4251b4ffe54 100644 --- a/erpnext/regional/doctype/uae_vat_settings/test_uae_vat_settings.py +++ b/erpnext/regional/doctype/uae_vat_settings/test_uae_vat_settings.py @@ -3,8 +3,8 @@ # import frappe import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestUAEVATSettings(IntegrationTestCase): +class TestUAEVATSettings(ERPNextTestSuite): pass diff --git a/erpnext/regional/united_states/test_united_states.py b/erpnext/regional/united_states/test_united_states.py index d3e7dcda620..ba282d3657a 100644 --- a/erpnext/regional/united_states/test_united_states.py +++ b/erpnext/regional/united_states/test_united_states.py @@ -3,12 +3,12 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from erpnext.regional.report.irs_1099.irs_1099 import execute as execute_1099_report +from erpnext.tests.utils import ERPNextTestSuite -class TestUnitedStates(IntegrationTestCase): +class TestUnitedStates(ERPNextTestSuite): def test_irs_1099_custom_field(self): if not frappe.db.exists("Supplier", "_US 1099 Test Supplier"): doc = frappe.new_doc("Supplier") diff --git a/erpnext/selling/doctype/customer/test_customer.py b/erpnext/selling/doctype/customer/test_customer.py index dee74837923..ce6b6e851c5 100644 --- a/erpnext/selling/doctype/customer/test_customer.py +++ b/erpnext/selling/doctype/customer/test_customer.py @@ -5,7 +5,6 @@ import json import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import flt from erpnext.accounts.party import get_due_date @@ -15,10 +14,10 @@ from erpnext.selling.doctype.customer.customer import ( get_customer_outstanding, parse_full_name, ) -from erpnext.tests.utils import create_test_contact_and_address +from erpnext.tests.utils import ERPNextTestSuite, create_test_contact_and_address -class TestCustomer(IntegrationTestCase): +class TestCustomer(ERPNextTestSuite): def tearDown(self): set_credit_limit("_Test Customer", "_Test Company", 0) diff --git a/erpnext/selling/doctype/installation_note/test_installation_note.py b/erpnext/selling/doctype/installation_note/test_installation_note.py index c6d1786cdee..62c5b761014 100644 --- a/erpnext/selling/doctype/installation_note/test_installation_note.py +++ b/erpnext/selling/doctype/installation_note/test_installation_note.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestInstallationNote(IntegrationTestCase): +class TestInstallationNote(ERPNextTestSuite): pass diff --git a/erpnext/selling/doctype/party_specific_item/test_party_specific_item.py b/erpnext/selling/doctype/party_specific_item/test_party_specific_item.py index 0259c5fcaee..6aaf02572b8 100644 --- a/erpnext/selling/doctype/party_specific_item/test_party_specific_item.py +++ b/erpnext/selling/doctype/party_specific_item/test_party_specific_item.py @@ -2,9 +2,9 @@ # See license.txt import frappe -from frappe.tests import IntegrationTestCase from erpnext.controllers.queries import item_query +from erpnext.tests.utils import ERPNextTestSuite def create_party_specific_item(**args): @@ -16,7 +16,7 @@ def create_party_specific_item(**args): psi.insert() -class TestPartySpecificItem(IntegrationTestCase): +class TestPartySpecificItem(ERPNextTestSuite): def setUp(self): self.customer = frappe.get_last_doc("Customer") self.supplier = frappe.get_last_doc("Supplier") diff --git a/erpnext/selling/doctype/quotation/test_quotation.py b/erpnext/selling/doctype/quotation/test_quotation.py index ab1528812eb..e1889d10fd1 100644 --- a/erpnext/selling/doctype/quotation/test_quotation.py +++ b/erpnext/selling/doctype/quotation/test_quotation.py @@ -4,15 +4,15 @@ import json import frappe -from frappe.tests import IntegrationTestCase, change_settings +from frappe.tests import change_settings from frappe.utils import add_days, add_months, flt, getdate, nowdate from erpnext.controllers.accounts_controller import InvalidQtyError, update_child_qty_rate from erpnext.selling.doctype.quotation.quotation import make_sales_order -from erpnext.setup.utils import get_exchange_rate +from erpnext.tests.utils import ERPNextTestSuite -class TestQuotation(IntegrationTestCase): +class TestQuotation(ERPNextTestSuite): def test_update_child_quotation_add_item(self): from erpnext.stock.doctype.item.test_item import make_item @@ -180,7 +180,7 @@ class TestQuotation(IntegrationTestCase): self.assertTrue(quotation.payment_schedule) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Accounts Settings", {"automatically_fetch_payment_terms": 1}, ) @@ -324,7 +324,7 @@ class TestQuotation(IntegrationTestCase): sales_order.delivery_date = nowdate() sales_order.insert() - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Accounts Settings", { "add_taxes_from_item_tax_template": 0, @@ -874,7 +874,7 @@ class TestQuotation(IntegrationTestCase): quotation.items[0].conversion_factor = 2.23 self.assertRaises(frappe.ValidationError, quotation.save) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Accounts Settings", {"add_taxes_from_item_tax_template": 1, "add_taxes_from_taxes_and_charges_template": 0}, ) @@ -942,7 +942,7 @@ class TestQuotation(IntegrationTestCase): self.assertEqual(quotation.rounding_adjustment, 0) self.assertEqual(quotation.rounded_total, 0) - @IntegrationTestCase.change_settings("Selling Settings", {"allow_zero_qty_in_quotation": 1}) + @ERPNextTestSuite.change_settings("Selling Settings", {"allow_zero_qty_in_quotation": 1}) def test_so_from_zero_qty_quotation(self): from erpnext.selling.doctype.quotation.quotation import make_sales_order from erpnext.stock.doctype.item.test_item import make_item @@ -1074,7 +1074,7 @@ class TestQuotation(IntegrationTestCase): quotation.reload() self.assertEqual(quotation.status, "Open") - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Accounts Settings", {"automatically_fetch_payment_terms": 1}, ) diff --git a/erpnext/selling/doctype/sales_order/test_sales_order.py b/erpnext/selling/doctype/sales_order/test_sales_order.py index 7d1c3749205..35322ff0d4e 100644 --- a/erpnext/selling/doctype/sales_order/test_sales_order.py +++ b/erpnext/selling/doctype/sales_order/test_sales_order.py @@ -7,8 +7,8 @@ from unittest.mock import patch import frappe import frappe.permissions from frappe.core.doctype.user_permission.test_user_permission import create_user -from frappe.tests import IntegrationTestCase, change_settings -from frappe.utils import add_days, flt, getdate, nowdate, today +from frappe.tests import change_settings +from frappe.utils import add_days, flt, nowdate, today from erpnext.accounts.test.accounts_mixin import AccountsTestMixin from erpnext.controllers.accounts_controller import InvalidQtyError, get_due_date, update_child_qty_rate @@ -32,9 +32,10 @@ from erpnext.selling.doctype.sales_order.sales_order import ( 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.get_item_details import get_bin_details +from erpnext.tests.utils import ERPNextTestSuite -class TestSalesOrder(AccountsTestMixin, IntegrationTestCase): +class TestSalesOrder(AccountsTestMixin, ERPNextTestSuite): @classmethod def setUpClass(cls): super().setUpClass() @@ -57,7 +58,7 @@ class TestSalesOrder(AccountsTestMixin, IntegrationTestCase): frappe.db.rollback() frappe.set_user("Administrator") - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Stock Settings", { "auto_insert_price_list_rate_if_missing": 1, @@ -144,7 +145,7 @@ class TestSalesOrder(AccountsTestMixin, IntegrationTestCase): so.reload() self.assertEqual(so.status, "Completed") - @IntegrationTestCase.change_settings("Selling Settings", {"allow_negative_rates_for_items": 1}) + @ERPNextTestSuite.change_settings("Selling Settings", {"allow_negative_rates_for_items": 1}) def test_sales_order_with_negative_rate(self): """ Test if negative rate is allowed in Sales Order via doc submission and update items @@ -265,7 +266,7 @@ class TestSalesOrder(AccountsTestMixin, IntegrationTestCase): so.load_from_db() self.assertEqual(so.per_billed, 0) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Accounts Settings", {"automatically_fetch_payment_terms": 1} ) # Enable auto fetch def test_make_sales_invoice_with_terms(self): @@ -296,7 +297,7 @@ class TestSalesOrder(AccountsTestMixin, IntegrationTestCase): si1 = make_sales_invoice(so.name) self.assertEqual(len(si1.get("items")), 0) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Accounts Settings", {"automatically_fetch_payment_terms": 1} ) # Enable auto fetch def test_auto_fetch_terms_enable(self): @@ -312,7 +313,7 @@ class TestSalesOrder(AccountsTestMixin, IntegrationTestCase): si.insert() si.submit() - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Accounts Settings", {"automatically_fetch_payment_terms": 0} ) # Disable auto fetch def test_auto_fetch_terms_disable(self): @@ -1544,7 +1545,7 @@ class TestSalesOrder(AccountsTestMixin, IntegrationTestCase): self.assertRaises(frappe.LinkExistsError, so_doc.cancel) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Accounts Settings", {"unlink_advance_payment_on_cancelation_of_order": 1} ) def test_advance_paid_upon_payment_cancellation(self): @@ -1801,7 +1802,7 @@ class TestSalesOrder(AccountsTestMixin, IntegrationTestCase): so.load_from_db() self.assertRaises(frappe.LinkExistsError, so.cancel) - @IntegrationTestCase.change_settings("Accounts Settings", {"automatically_fetch_payment_terms": 1}) + @ERPNextTestSuite.change_settings("Accounts Settings", {"automatically_fetch_payment_terms": 1}) def test_payment_terms_are_fetched_when_creating_sales_invoice(self): from erpnext.accounts.doctype.payment_entry.test_payment_entry import ( create_payment_terms_template, @@ -2133,7 +2134,7 @@ class TestSalesOrder(AccountsTestMixin, IntegrationTestCase): self.assertEqual(len(dn.packed_items), 1) self.assertEqual(dn.items[0].item_code, "_Test Product Bundle Item Partial 2") - @IntegrationTestCase.change_settings("Selling Settings", {"editable_bundle_item_rates": 1}) + @ERPNextTestSuite.change_settings("Selling Settings", {"editable_bundle_item_rates": 1}) def test_expired_rate_for_packed_item(self): bundle = "_Test Product Bundle 1" packed_item = "_Packed Item 1" @@ -2471,7 +2472,7 @@ class TestSalesOrder(AccountsTestMixin, IntegrationTestCase): self.assertRaises(frappe.ValidationError, so1.update_status, "Draft") - @IntegrationTestCase.change_settings("Stock Settings", {"enable_stock_reservation": True}) + @ERPNextTestSuite.change_settings("Stock Settings", {"enable_stock_reservation": True}) def test_warehouse_mapping_based_on_stock_reservation(self): self.create_company(company_name="Glass Ceiling", abbr="GC") self.create_item("Lamy Safari 2", True, self.warehouse_stores, self.company, 2000) @@ -2585,7 +2586,7 @@ class TestSalesOrder(AccountsTestMixin, IntegrationTestCase): sre_doc.reload() self.assertTrue(sre_doc.status == "Delivered") - @IntegrationTestCase.change_settings("Selling Settings", {"allow_zero_qty_in_sales_order": 1}) + @ERPNextTestSuite.change_settings("Selling Settings", {"allow_zero_qty_in_sales_order": 1}) def test_deliver_zero_qty_purchase_order(self): """ Test the flow of a Unit Price SO and DN creation against it until completion. @@ -2633,7 +2634,7 @@ class TestSalesOrder(AccountsTestMixin, IntegrationTestCase): self.assertEqual(so.per_delivered, 100.0) self.assertEqual(so.status, "To Bill") - @IntegrationTestCase.change_settings("Selling Settings", {"allow_zero_qty_in_sales_order": 1}) + @ERPNextTestSuite.change_settings("Selling Settings", {"allow_zero_qty_in_sales_order": 1}) def test_bill_zero_qty_sales_order(self): so = make_sales_order(qty=0) diff --git a/erpnext/selling/doctype/sales_partner_type/test_sales_partner_type.py b/erpnext/selling/doctype/sales_partner_type/test_sales_partner_type.py index 8f35c48de0c..e2b29e70e30 100644 --- a/erpnext/selling/doctype/sales_partner_type/test_sales_partner_type.py +++ b/erpnext/selling/doctype/sales_partner_type/test_sales_partner_type.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestSalesPartnerType(IntegrationTestCase): +class TestSalesPartnerType(ERPNextTestSuite): pass diff --git a/erpnext/selling/doctype/selling_settings/test_selling_settings.py b/erpnext/selling/doctype/selling_settings/test_selling_settings.py index 91a73d92ec3..c3ec1d3f3bd 100644 --- a/erpnext/selling/doctype/selling_settings/test_selling_settings.py +++ b/erpnext/selling/doctype/selling_settings/test_selling_settings.py @@ -3,10 +3,11 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase + +from erpnext.tests.utils import ERPNextTestSuite -class TestSellingSettings(IntegrationTestCase): +class TestSellingSettings(ERPNextTestSuite): def test_defaults_populated(self): # Setup default values are not populated on migrate, this test checks # if setup was completed correctly diff --git a/erpnext/selling/report/payment_terms_status_for_sales_order/test_payment_terms_status_for_sales_order.py b/erpnext/selling/report/payment_terms_status_for_sales_order/test_payment_terms_status_for_sales_order.py index d8eba371534..1f87f9993b7 100644 --- a/erpnext/selling/report/payment_terms_status_for_sales_order/test_payment_terms_status_for_sales_order.py +++ b/erpnext/selling/report/payment_terms_status_for_sales_order/test_payment_terms_status_for_sales_order.py @@ -1,7 +1,6 @@ import datetime import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import add_days, add_months, nowdate from erpnext.selling.doctype.sales_order.sales_order import make_sales_invoice @@ -10,9 +9,10 @@ from erpnext.selling.report.payment_terms_status_for_sales_order.payment_terms_s execute, ) from erpnext.stock.doctype.item.test_item import create_item +from erpnext.tests.utils import ERPNextTestSuite -class TestPaymentTermsStatusForSalesOrder(IntegrationTestCase): +class TestPaymentTermsStatusForSalesOrder(ERPNextTestSuite): def tearDown(self): frappe.db.rollback() @@ -137,7 +137,7 @@ class TestPaymentTermsStatusForSalesOrder(IntegrationTestCase): ) doc.insert() - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Accounts Settings", allow_multi_currency_invoices_against_single_party_account=1 ) def test_02_alternate_currency(self): diff --git a/erpnext/selling/report/pending_so_items_for_purchase_request/test_pending_so_items_for_purchase_request.py b/erpnext/selling/report/pending_so_items_for_purchase_request/test_pending_so_items_for_purchase_request.py index cfb960fd8ad..3f540a3b94a 100644 --- a/erpnext/selling/report/pending_so_items_for_purchase_request/test_pending_so_items_for_purchase_request.py +++ b/erpnext/selling/report/pending_so_items_for_purchase_request/test_pending_so_items_for_purchase_request.py @@ -2,7 +2,6 @@ # For license information, please see license.txt -from frappe.tests import IntegrationTestCase from frappe.utils import add_months, nowdate from erpnext.selling.doctype.sales_order.sales_order import make_material_request @@ -10,9 +9,10 @@ from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_orde from erpnext.selling.report.pending_so_items_for_purchase_request.pending_so_items_for_purchase_request import ( execute, ) +from erpnext.tests.utils import ERPNextTestSuite -class TestPendingSOItemsForPurchaseRequest(IntegrationTestCase): +class TestPendingSOItemsForPurchaseRequest(ERPNextTestSuite): def test_result_for_partial_material_request(self): so = make_sales_order() mr = make_material_request(so.name) diff --git a/erpnext/selling/report/sales_analytics/test_analytics.py b/erpnext/selling/report/sales_analytics/test_analytics.py index af7d93be9bb..cada5c07c81 100644 --- a/erpnext/selling/report/sales_analytics/test_analytics.py +++ b/erpnext/selling/report/sales_analytics/test_analytics.py @@ -3,13 +3,13 @@ import frappe -from frappe.tests import IntegrationTestCase from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order from erpnext.selling.report.sales_analytics.sales_analytics import execute +from erpnext.tests.utils import ERPNextTestSuite -class TestAnalytics(IntegrationTestCase): +class TestAnalytics(ERPNextTestSuite): def test_sales_analytics(self): frappe.db.sql("delete from `tabSales Order` where company='_Test Company 2'") diff --git a/erpnext/selling/report/sales_order_analysis/test_sales_order_analysis.py b/erpnext/selling/report/sales_order_analysis/test_sales_order_analysis.py index 76dc0dfff85..79eae15bd01 100644 --- a/erpnext/selling/report/sales_order_analysis/test_sales_order_analysis.py +++ b/erpnext/selling/report/sales_order_analysis/test_sales_order_analysis.py @@ -1,14 +1,14 @@ import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import add_days from erpnext.selling.doctype.sales_order.sales_order import make_delivery_note, make_sales_invoice from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order from erpnext.selling.report.sales_order_analysis.sales_order_analysis import execute from erpnext.stock.doctype.item.test_item import create_item +from erpnext.tests.utils import ERPNextTestSuite -class TestSalesOrderAnalysis(IntegrationTestCase): +class TestSalesOrderAnalysis(ERPNextTestSuite): def create_sales_order(self, transaction_date, do_not_save=False, do_not_submit=False): item = create_item(item_code="_Test Excavator", is_stock_item=0) so = make_sales_order( diff --git a/erpnext/selling/report/sales_partner_target_variance_based_on_item_group/test_sales_partner_target_variance_based_on_item_group.py b/erpnext/selling/report/sales_partner_target_variance_based_on_item_group/test_sales_partner_target_variance_based_on_item_group.py index 0f5ee17330a..cfcfc2f3ed4 100644 --- a/erpnext/selling/report/sales_partner_target_variance_based_on_item_group/test_sales_partner_target_variance_based_on_item_group.py +++ b/erpnext/selling/report/sales_partner_target_variance_based_on_item_group/test_sales_partner_target_variance_based_on_item_group.py @@ -1,5 +1,4 @@ import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import flt, nowdate from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice @@ -11,9 +10,10 @@ from erpnext.selling.report.sales_person_target_variance_based_on_item_group.tes create_sales_target_doc, create_target_distribution, ) +from erpnext.tests.utils import ERPNextTestSuite -class TestSalesPartnerTargetVarianceBasedOnItemGroup(IntegrationTestCase): +class TestSalesPartnerTargetVarianceBasedOnItemGroup(ERPNextTestSuite): def setUp(self): self.fiscal_year = get_fiscal_year(nowdate())[0] diff --git a/erpnext/selling/report/sales_person_target_variance_based_on_item_group/test_sales_person_target_variance_based_on_item_group.py b/erpnext/selling/report/sales_person_target_variance_based_on_item_group/test_sales_person_target_variance_based_on_item_group.py index 52bd213a85d..a5dff54a372 100644 --- a/erpnext/selling/report/sales_person_target_variance_based_on_item_group/test_sales_person_target_variance_based_on_item_group.py +++ b/erpnext/selling/report/sales_person_target_variance_based_on_item_group/test_sales_person_target_variance_based_on_item_group.py @@ -1,5 +1,4 @@ import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import flt, nowdate from erpnext.accounts.utils import get_fiscal_year @@ -7,9 +6,10 @@ from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_orde from erpnext.selling.report.sales_person_target_variance_based_on_item_group.sales_person_target_variance_based_on_item_group import ( execute, ) +from erpnext.tests.utils import ERPNextTestSuite -class TestSalesPersonTargetVarianceBasedOnItemGroup(IntegrationTestCase): +class TestSalesPersonTargetVarianceBasedOnItemGroup(ERPNextTestSuite): def setUp(self): self.fiscal_year = get_fiscal_year(nowdate())[0] diff --git a/erpnext/setup/doctype/authorization_rule/test_authorization_rule.py b/erpnext/setup/doctype/authorization_rule/test_authorization_rule.py index 63c34c271e0..e3fab7dbd5c 100644 --- a/erpnext/setup/doctype/authorization_rule/test_authorization_rule.py +++ b/erpnext/setup/doctype/authorization_rule/test_authorization_rule.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestAuthorizationRule(IntegrationTestCase): +class TestAuthorizationRule(ERPNextTestSuite): pass diff --git a/erpnext/setup/doctype/currency_exchange/test_currency_exchange.py b/erpnext/setup/doctype/currency_exchange/test_currency_exchange.py index c0fad18795e..c6f08c305ee 100644 --- a/erpnext/setup/doctype/currency_exchange/test_currency_exchange.py +++ b/erpnext/setup/doctype/currency_exchange/test_currency_exchange.py @@ -4,10 +4,10 @@ import unittest from unittest import mock import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import cint, flt from erpnext.setup.utils import get_exchange_rate +from erpnext.tests.utils import ERPNextTestSuite def save_new_records(test_records): @@ -78,7 +78,7 @@ def patched_requests_get(*args, **kwargs): @mock.patch("requests.get", side_effect=patched_requests_get) -class TestCurrencyExchange(IntegrationTestCase): +class TestCurrencyExchange(ERPNextTestSuite): def clear_cache(self): cache = frappe.cache() for date in test_exchange_values.keys(): diff --git a/erpnext/setup/doctype/department/test_department.py b/erpnext/setup/doctype/department/test_department.py index 274361749fd..2a1c357f751 100644 --- a/erpnext/setup/doctype/department/test_department.py +++ b/erpnext/setup/doctype/department/test_department.py @@ -3,10 +3,11 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase + +from erpnext.tests.utils import ERPNextTestSuite -class TestDepartment(IntegrationTestCase): +class TestDepartment(ERPNextTestSuite): def test_remove_department_data(self): doc = create_department("Test Department") frappe.delete_doc("Department", doc.name) diff --git a/erpnext/setup/doctype/driver/test_driver.py b/erpnext/setup/doctype/driver/test_driver.py index d75d7ab8977..3230391707d 100644 --- a/erpnext/setup/doctype/driver/test_driver.py +++ b/erpnext/setup/doctype/driver/test_driver.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestDriver(IntegrationTestCase): +class TestDriver(ERPNextTestSuite): pass diff --git a/erpnext/setup/doctype/email_digest/test_email_digest.py b/erpnext/setup/doctype/email_digest/test_email_digest.py index 13a97ea86ea..7ea0da03382 100644 --- a/erpnext/setup/doctype/email_digest/test_email_digest.py +++ b/erpnext/setup/doctype/email_digest/test_email_digest.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestEmailDigest(IntegrationTestCase): +class TestEmailDigest(ERPNextTestSuite): pass diff --git a/erpnext/setup/doctype/employee/test_employee.py b/erpnext/setup/doctype/employee/test_employee.py index 73de3bf2e5d..90b7cff1fba 100644 --- a/erpnext/setup/doctype/employee/test_employee.py +++ b/erpnext/setup/doctype/employee/test_employee.py @@ -5,14 +5,14 @@ import unittest import frappe import frappe.utils from frappe.query_builder import Criterion -from frappe.tests import IntegrationTestCase import erpnext from erpnext.accounts.utils import build_qb_match_conditions from erpnext.setup.doctype.employee.employee import InactiveEmployeeStatusError +from erpnext.tests.utils import ERPNextTestSuite -class TestEmployee(IntegrationTestCase): +class TestEmployee(ERPNextTestSuite): def test_employee_status_left(self): employee1 = make_employee("test_employee_1@company.com") employee2 = make_employee("test_employee_2@company.com") diff --git a/erpnext/setup/doctype/employee_group/test_employee_group.py b/erpnext/setup/doctype/employee_group/test_employee_group.py index 9003d72bbe4..6d7ed2614c5 100644 --- a/erpnext/setup/doctype/employee_group/test_employee_group.py +++ b/erpnext/setup/doctype/employee_group/test_employee_group.py @@ -3,12 +3,12 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from erpnext.setup.doctype.employee.test_employee import make_employee +from erpnext.tests.utils import ERPNextTestSuite -class TestEmployeeGroup(IntegrationTestCase): +class TestEmployeeGroup(ERPNextTestSuite): pass diff --git a/erpnext/setup/doctype/global_defaults/test_global_defaults.py b/erpnext/setup/doctype/global_defaults/test_global_defaults.py index 3a301ba4232..303ca64ce88 100644 --- a/erpnext/setup/doctype/global_defaults/test_global_defaults.py +++ b/erpnext/setup/doctype/global_defaults/test_global_defaults.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestGlobalDefaults(IntegrationTestCase): +class TestGlobalDefaults(ERPNextTestSuite): pass diff --git a/erpnext/setup/doctype/holiday_list/test_holiday_list.py b/erpnext/setup/doctype/holiday_list/test_holiday_list.py index c5dbf0258df..342918b8d64 100644 --- a/erpnext/setup/doctype/holiday_list/test_holiday_list.py +++ b/erpnext/setup/doctype/holiday_list/test_holiday_list.py @@ -5,13 +5,13 @@ from contextlib import contextmanager from datetime import date, timedelta import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import getdate from erpnext.setup.doctype.holiday_list.holiday_list import local_country_name +from erpnext.tests.utils import ERPNextTestSuite -class TestHolidayList(IntegrationTestCase): +class TestHolidayList(ERPNextTestSuite): def test_holiday_list(self): today_date = getdate() test_holiday_dates = [today_date - timedelta(days=5), today_date - timedelta(days=4)] diff --git a/erpnext/setup/doctype/incoterm/test_incoterm.py b/erpnext/setup/doctype/incoterm/test_incoterm.py index e38854e648b..d9338cac5af 100644 --- a/erpnext/setup/doctype/incoterm/test_incoterm.py +++ b/erpnext/setup/doctype/incoterm/test_incoterm.py @@ -2,8 +2,10 @@ # See license.txt # import frappe -from frappe.tests import IntegrationTestCase -class TestIncoterm(IntegrationTestCase): +from erpnext.tests.utils import ERPNextTestSuite + + +class TestIncoterm(ERPNextTestSuite): pass diff --git a/erpnext/setup/doctype/item_group/test_item_group.py b/erpnext/setup/doctype/item_group/test_item_group.py index b6b9c9cdad6..f1a8697e00c 100644 --- a/erpnext/setup/doctype/item_group/test_item_group.py +++ b/erpnext/setup/doctype/item_group/test_item_group.py @@ -3,7 +3,6 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from frappe.utils.nestedset import ( NestedSetChildExistsError, NestedSetInvalidMergeError, @@ -13,8 +12,10 @@ from frappe.utils.nestedset import ( rebuild_tree, ) +from erpnext.tests.utils import ERPNextTestSuite -class TestItem(IntegrationTestCase): + +class TestItem(ERPNextTestSuite): def test_basic_tree(self, records=None): min_lft = 1 max_rgt = frappe.db.sql("select max(rgt) from `tabItem Group`")[0][0] diff --git a/erpnext/setup/doctype/party_type/test_party_type.py b/erpnext/setup/doctype/party_type/test_party_type.py index de199d5004c..85223760843 100644 --- a/erpnext/setup/doctype/party_type/test_party_type.py +++ b/erpnext/setup/doctype/party_type/test_party_type.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestPartyType(IntegrationTestCase): +class TestPartyType(ERPNextTestSuite): pass diff --git a/erpnext/setup/doctype/transaction_deletion_record/test_transaction_deletion_record.py b/erpnext/setup/doctype/transaction_deletion_record/test_transaction_deletion_record.py index b1c96fc66b0..191542d80c1 100644 --- a/erpnext/setup/doctype/transaction_deletion_record/test_transaction_deletion_record.py +++ b/erpnext/setup/doctype/transaction_deletion_record/test_transaction_deletion_record.py @@ -3,10 +3,11 @@ import frappe -from frappe.tests import IntegrationTestCase + +from erpnext.tests.utils import ERPNextTestSuite -class TestTransactionDeletionRecord(IntegrationTestCase): +class TestTransactionDeletionRecord(ERPNextTestSuite): def setUp(self): # Clear all deletion cache flags from previous tests self._clear_all_deletion_cache_flags() diff --git a/erpnext/setup/doctype/uom_conversion_factor/test_uom_conversion_factor.py b/erpnext/setup/doctype/uom_conversion_factor/test_uom_conversion_factor.py index dd9346dd8ac..642165dbb60 100644 --- a/erpnext/setup/doctype/uom_conversion_factor/test_uom_conversion_factor.py +++ b/erpnext/setup/doctype/uom_conversion_factor/test_uom_conversion_factor.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestUOMConversionFactor(IntegrationTestCase): +class TestUOMConversionFactor(ERPNextTestSuite): pass diff --git a/erpnext/setup/doctype/vehicle/test_vehicle.py b/erpnext/setup/doctype/vehicle/test_vehicle.py index d5d464f67ed..c3b367e9f7e 100644 --- a/erpnext/setup/doctype/vehicle/test_vehicle.py +++ b/erpnext/setup/doctype/vehicle/test_vehicle.py @@ -3,11 +3,12 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import random_string +from erpnext.tests.utils import ERPNextTestSuite -class TestVehicle(IntegrationTestCase): + +class TestVehicle(ERPNextTestSuite): def test_make_vehicle(self): vehicle = frappe.get_doc( { diff --git a/erpnext/stock/doctype/batch/test_batch.py b/erpnext/stock/doctype/batch/test_batch.py index 31d6cc1f241..1ba25cb44f3 100644 --- a/erpnext/stock/doctype/batch/test_batch.py +++ b/erpnext/stock/doctype/batch/test_batch.py @@ -5,7 +5,6 @@ import json import frappe from frappe.exceptions import ValidationError -from frappe.tests import IntegrationTestCase from frappe.utils import cint, flt from frappe.utils.data import add_to_date, getdate @@ -22,9 +21,10 @@ from erpnext.stock.doctype.serial_and_batch_bundle.test_serial_and_batch_bundle from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry from erpnext.stock.get_item_details import ItemDetailsCtx, get_item_details from erpnext.stock.serial_batch_bundle import SerialBatchCreation +from erpnext.tests.utils import ERPNextTestSuite -class TestBatch(IntegrationTestCase): +class TestBatch(ERPNextTestSuite): def test_item_has_batch_enabled(self): self.assertRaises( ValidationError, diff --git a/erpnext/stock/doctype/bin/test_bin.py b/erpnext/stock/doctype/bin/test_bin.py index 7ed3089e05e..93688948581 100644 --- a/erpnext/stock/doctype/bin/test_bin.py +++ b/erpnext/stock/doctype/bin/test_bin.py @@ -2,13 +2,13 @@ # See license.txt import frappe -from frappe.tests import IntegrationTestCase from erpnext.stock.doctype.item.test_item import make_item from erpnext.stock.utils import _create_bin +from erpnext.tests.utils import ERPNextTestSuite -class TestBin(IntegrationTestCase): +class TestBin(ERPNextTestSuite): def test_concurrent_inserts(self): """Ensure no duplicates are possible in case of concurrent inserts""" item_code = "_TestConcurrentBin" diff --git a/erpnext/stock/doctype/customs_tariff_number/test_customs_tariff_number.py b/erpnext/stock/doctype/customs_tariff_number/test_customs_tariff_number.py index 9496e3ed5a0..234b3871750 100644 --- a/erpnext/stock/doctype/customs_tariff_number/test_customs_tariff_number.py +++ b/erpnext/stock/doctype/customs_tariff_number/test_customs_tariff_number.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestCustomsTariffNumber(IntegrationTestCase): +class TestCustomsTariffNumber(ERPNextTestSuite): pass diff --git a/erpnext/stock/doctype/delivery_note/test_delivery_note.py b/erpnext/stock/doctype/delivery_note/test_delivery_note.py index 8ce354d1058..2430eb219a9 100644 --- a/erpnext/stock/doctype/delivery_note/test_delivery_note.py +++ b/erpnext/stock/doctype/delivery_note/test_delivery_note.py @@ -6,7 +6,6 @@ import json from collections import defaultdict import frappe -from frappe.tests import IntegrationTestCase, change_settings from frappe.utils import add_days, cstr, flt, getdate, nowdate, nowtime, today from erpnext.accounts.doctype.account.test_account import get_inventory_account @@ -42,9 +41,10 @@ from erpnext.stock.doctype.stock_reconciliation.test_stock_reconciliation import ) from erpnext.stock.doctype.warehouse.test_warehouse import get_warehouse from erpnext.stock.stock_ledger import get_previous_sle +from erpnext.tests.utils import ERPNextTestSuite -class TestDeliveryNote(IntegrationTestCase): +class TestDeliveryNote(ERPNextTestSuite): def test_delivery_note_qty(self): dn = create_delivery_note(qty=0, do_not_save=True) with self.assertRaises(InvalidQtyError): @@ -1022,7 +1022,7 @@ class TestDeliveryNote(IntegrationTestCase): self.assertEqual(dn2.per_billed, 100) self.assertEqual(dn2.status, "Completed") - @change_settings("Accounts Settings", {"delete_linked_ledger_entries": True}) + @ERPNextTestSuite.change_settings("Accounts Settings", {"delete_linked_ledger_entries": True}) def test_sales_invoice_qty_after_return(self): from erpnext.stock.doctype.delivery_note.delivery_note import make_sales_return @@ -1323,7 +1323,7 @@ class TestDeliveryNote(IntegrationTestCase): frappe.db.set_single_value("Stock Settings", "use_serial_batch_fields", 1) frappe.db.set_single_value("Accounts Settings", "delete_linked_ledger_entries", 0) - @change_settings("Accounts Settings", {"automatically_fetch_payment_terms": 1}) + @ERPNextTestSuite.change_settings("Accounts Settings", {"automatically_fetch_payment_terms": 1}) def test_payment_terms_are_fetched_when_creating_sales_invoice(self): from erpnext.accounts.doctype.payment_entry.test_payment_entry import ( create_payment_terms_template, @@ -2865,7 +2865,7 @@ class TestDeliveryNote(IntegrationTestCase): for entry in sabb.entries: self.assertEqual(entry.incoming_rate, 200) - @IntegrationTestCase.change_settings("Selling Settings", {"validate_selling_price": 1}) + @ERPNextTestSuite.change_settings("Selling Settings", {"validate_selling_price": 1}) def test_validate_selling_price(self): item_code = make_item("VSP Item", properties={"is_stock_item": 1}).name make_stock_entry(item_code=item_code, target="_Test Warehouse - _TC", qty=1, basic_rate=10) diff --git a/erpnext/stock/doctype/delivery_settings/test_delivery_settings.py b/erpnext/stock/doctype/delivery_settings/test_delivery_settings.py index 2ecbb9e8861..18f83b4d22b 100644 --- a/erpnext/stock/doctype/delivery_settings/test_delivery_settings.py +++ b/erpnext/stock/doctype/delivery_settings/test_delivery_settings.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestDeliverySettings(IntegrationTestCase): +class TestDeliverySettings(ERPNextTestSuite): pass diff --git a/erpnext/stock/doctype/delivery_trip/test_delivery_trip.py b/erpnext/stock/doctype/delivery_trip/test_delivery_trip.py index 9966af7c99b..8e467f84fba 100644 --- a/erpnext/stock/doctype/delivery_trip/test_delivery_trip.py +++ b/erpnext/stock/doctype/delivery_trip/test_delivery_trip.py @@ -3,7 +3,6 @@ import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import add_days, flt, now_datetime, nowdate import erpnext @@ -11,10 +10,10 @@ from erpnext.stock.doctype.delivery_trip.delivery_trip import ( get_contact_and_address, notify_customers, ) -from erpnext.tests.utils import create_test_contact_and_address +from erpnext.tests.utils import ERPNextTestSuite, create_test_contact_and_address -class TestDeliveryTrip(IntegrationTestCase): +class TestDeliveryTrip(ERPNextTestSuite): def setUp(self): super().setUp() driver = create_driver() diff --git a/erpnext/stock/doctype/inventory_dimension/test_inventory_dimension.py b/erpnext/stock/doctype/inventory_dimension/test_inventory_dimension.py index 1d7c475d1ae..ca61b9344c0 100644 --- a/erpnext/stock/doctype/inventory_dimension/test_inventory_dimension.py +++ b/erpnext/stock/doctype/inventory_dimension/test_inventory_dimension.py @@ -3,7 +3,6 @@ import frappe from frappe.custom.doctype.custom_field.custom_field import create_custom_field -from frappe.tests import IntegrationTestCase, change_settings from frappe.utils import nowdate, nowtime from erpnext.stock.doctype.delivery_note.test_delivery_note import create_delivery_note @@ -19,9 +18,10 @@ from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import make_pu from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry from erpnext.stock.doctype.stock_ledger_entry.stock_ledger_entry import InventoryDimensionNegativeStockError from erpnext.stock.doctype.warehouse.test_warehouse import create_warehouse +from erpnext.tests.utils import ERPNextTestSuite -class TestInventoryDimension(IntegrationTestCase): +class TestInventoryDimension(ERPNextTestSuite): def setUp(self): prepare_test_data() create_store_dimension() @@ -497,7 +497,7 @@ class TestInventoryDimension(IntegrationTestCase): self.assertEqual(site_name, "Site 1") - @change_settings("Stock Settings", {"allow_negative_stock": 0}) + @ERPNextTestSuite.change_settings("Stock Settings", {"allow_negative_stock": 0}) def test_validate_negative_stock_with_multiple_dimension(self): item_code = "Test Negative Multi Inventory Dimension Item" create_item(item_code) diff --git a/erpnext/stock/doctype/item/test_item.py b/erpnext/stock/doctype/item/test_item.py index c2de1e54fdb..132aef65e5f 100644 --- a/erpnext/stock/doctype/item/test_item.py +++ b/erpnext/stock/doctype/item/test_item.py @@ -7,7 +7,6 @@ import json import frappe from frappe.custom.doctype.property_setter.property_setter import make_property_setter from frappe.test_runner import make_test_objects -from frappe.tests import IntegrationTestCase from frappe.utils import add_days, today from erpnext.controllers.item_variant import ( @@ -27,6 +26,7 @@ from erpnext.stock.doctype.item.item import ( ) from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry from erpnext.stock.get_item_details import ItemDetailsCtx, get_item_details +from erpnext.tests.utils import ERPNextTestSuite def make_item(item_code=None, properties=None, uoms=None, barcode=None): @@ -71,7 +71,7 @@ def make_item(item_code=None, properties=None, uoms=None, barcode=None): return item -class TestItem(IntegrationTestCase): +class TestItem(ERPNextTestSuite): def setUp(self): super().setUp() frappe.flags.attribute_values = None @@ -738,13 +738,13 @@ class TestItem(IntegrationTestCase): except frappe.ValidationError as e: self.fail(f"stock item considered non-stock item: {e}") - @IntegrationTestCase.change_settings("Stock Settings", {"item_naming_by": "Naming Series"}) + @ERPNextTestSuite.change_settings("Stock Settings", {"item_naming_by": "Naming Series"}) def test_autoname_series(self): item = frappe.new_doc("Item") item.item_group = "All Item Groups" item.save() # if item code saved without item_code then series worked - @IntegrationTestCase.change_settings("Stock Settings", {"allow_negative_stock": 0}) + @ERPNextTestSuite.change_settings("Stock Settings", {"allow_negative_stock": 0}) def test_item_wise_negative_stock(self): """When global settings are disabled check that item that allows negative stock can still consume material in all known stock @@ -756,7 +756,7 @@ class TestItem(IntegrationTestCase): self.consume_item_code_with_differet_stock_transactions(item_code=item.name) - @IntegrationTestCase.change_settings("Stock Settings", {"allow_negative_stock": 0}) + @ERPNextTestSuite.change_settings("Stock Settings", {"allow_negative_stock": 0}) def test_backdated_negative_stock(self): """same as test above but backdated entries""" from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry @@ -769,7 +769,7 @@ class TestItem(IntegrationTestCase): ) self.consume_item_code_with_differet_stock_transactions(item_code=item.name) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Stock Settings", {"sample_retention_warehouse": "_Test Warehouse - _TC"} ) def test_retain_sample(self): diff --git a/erpnext/stock/doctype/item_alternative/test_item_alternative.py b/erpnext/stock/doctype/item_alternative/test_item_alternative.py index d96061e0d94..0a2119af3ec 100644 --- a/erpnext/stock/doctype/item_alternative/test_item_alternative.py +++ b/erpnext/stock/doctype/item_alternative/test_item_alternative.py @@ -2,7 +2,6 @@ # See license.txt import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import flt from erpnext.controllers.subcontracting_controller import make_rm_stock_entry @@ -24,9 +23,10 @@ from erpnext.stock.doctype.stock_reconciliation.test_stock_reconciliation import from erpnext.subcontracting.doctype.subcontracting_order.subcontracting_order import ( make_subcontracting_receipt, ) +from erpnext.tests.utils import ERPNextTestSuite -class TestItemAlternative(IntegrationTestCase): +class TestItemAlternative(ERPNextTestSuite): def setUp(self): super().setUp() make_items() diff --git a/erpnext/stock/doctype/item_attribute/test_item_attribute.py b/erpnext/stock/doctype/item_attribute/test_item_attribute.py index 7ed800dca19..63958733eba 100644 --- a/erpnext/stock/doctype/item_attribute/test_item_attribute.py +++ b/erpnext/stock/doctype/item_attribute/test_item_attribute.py @@ -3,12 +3,12 @@ import frappe -from frappe.tests import IntegrationTestCase from erpnext.stock.doctype.item_attribute.item_attribute import ItemAttributeIncrementError +from erpnext.tests.utils import ERPNextTestSuite -class TestItemAttribute(IntegrationTestCase): +class TestItemAttribute(ERPNextTestSuite): def setUp(self): super().setUp() if frappe.db.exists("Item Attribute", "_Test_Length"): diff --git a/erpnext/stock/doctype/item_manufacturer/test_item_manufacturer.py b/erpnext/stock/doctype/item_manufacturer/test_item_manufacturer.py index bf82f3611ed..74bc8c37cd0 100644 --- a/erpnext/stock/doctype/item_manufacturer/test_item_manufacturer.py +++ b/erpnext/stock/doctype/item_manufacturer/test_item_manufacturer.py @@ -3,8 +3,8 @@ # import frappe import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestItemManufacturer(IntegrationTestCase): +class TestItemManufacturer(ERPNextTestSuite): pass diff --git a/erpnext/stock/doctype/item_price/test_item_price.py b/erpnext/stock/doctype/item_price/test_item_price.py index 42726054c1b..5df5ae166c9 100644 --- a/erpnext/stock/doctype/item_price/test_item_price.py +++ b/erpnext/stock/doctype/item_price/test_item_price.py @@ -3,14 +3,14 @@ import frappe -from frappe.tests import IntegrationTestCase from frappe.tests.utils import make_test_records_for_doctype from erpnext.stock.doctype.item_price.item_price import ItemPriceDuplicateItem from erpnext.stock.get_item_details import ItemDetailsCtx, get_price_list_rate_for +from erpnext.tests.utils import ERPNextTestSuite -class TestItemPrice(IntegrationTestCase): +class TestItemPrice(ERPNextTestSuite): def setUp(self): super().setUp() frappe.db.sql("delete from `tabItem Price`") diff --git a/erpnext/stock/doctype/item_variant_settings/test_item_variant_settings.py b/erpnext/stock/doctype/item_variant_settings/test_item_variant_settings.py index b526eadd8e8..8eb4c864ae5 100644 --- a/erpnext/stock/doctype/item_variant_settings/test_item_variant_settings.py +++ b/erpnext/stock/doctype/item_variant_settings/test_item_variant_settings.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestItemVariantSettings(IntegrationTestCase): +class TestItemVariantSettings(ERPNextTestSuite): pass diff --git a/erpnext/stock/doctype/landed_cost_voucher/test_landed_cost_voucher.py b/erpnext/stock/doctype/landed_cost_voucher/test_landed_cost_voucher.py index 57de08306da..b24fcfcf712 100644 --- a/erpnext/stock/doctype/landed_cost_voucher/test_landed_cost_voucher.py +++ b/erpnext/stock/doctype/landed_cost_voucher/test_landed_cost_voucher.py @@ -5,7 +5,6 @@ import copy import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import add_days, add_to_date, flt, now, nowtime, today from erpnext.accounts.doctype.account.test_account import create_account, get_inventory_account @@ -21,10 +20,10 @@ from erpnext.stock.doctype.serial_and_batch_bundle.test_serial_and_batch_bundle get_serial_nos_from_bundle, ) from erpnext.stock.serial_batch_bundle import SerialNoValuation +from erpnext.tests.utils import ERPNextTestSuite - -class TestLandedCostVoucher(IntegrationTestCase): +class TestLandedCostVoucher(ERPNextTestSuite): def test_landed_cost_voucher(self): frappe.db.set_single_value("Buying Settings", "allow_multiple_items", 1) diff --git a/erpnext/stock/doctype/manufacturer/test_manufacturer.py b/erpnext/stock/doctype/manufacturer/test_manufacturer.py index 1469901e26a..4caa84be53a 100644 --- a/erpnext/stock/doctype/manufacturer/test_manufacturer.py +++ b/erpnext/stock/doctype/manufacturer/test_manufacturer.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestManufacturer(IntegrationTestCase): +class TestManufacturer(ERPNextTestSuite): pass diff --git a/erpnext/stock/doctype/material_request/test_material_request.py b/erpnext/stock/doctype/material_request/test_material_request.py index b04cbbee1f1..dd6ba500099 100644 --- a/erpnext/stock/doctype/material_request/test_material_request.py +++ b/erpnext/stock/doctype/material_request/test_material_request.py @@ -6,7 +6,6 @@ import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import flt, today from erpnext.controllers.accounts_controller import InvalidQtyError @@ -21,9 +20,10 @@ from erpnext.stock.doctype.material_request.material_request import ( ) from erpnext.stock.doctype.stock_entry.stock_entry import make_stock_in_entry from erpnext.stock.doctype.warehouse.test_warehouse import create_warehouse +from erpnext.tests.utils import ERPNextTestSuite -class TestMaterialRequest(IntegrationTestCase): +class TestMaterialRequest(ERPNextTestSuite): def test_material_request_qty(self): mr = frappe.copy_doc(self.globalTestRecords["Material Request"][0]) mr.items[0].qty = 0 diff --git a/erpnext/stock/doctype/packed_item/test_packed_item.py b/erpnext/stock/doctype/packed_item/test_packed_item.py index 5ace12184a7..8bab935cda7 100644 --- a/erpnext/stock/doctype/packed_item/test_packed_item.py +++ b/erpnext/stock/doctype/packed_item/test_packed_item.py @@ -3,7 +3,6 @@ import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import add_to_date, nowdate from erpnext.selling.doctype.sales_order.sales_order import make_delivery_note @@ -11,6 +10,7 @@ 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.purchase_receipt.test_purchase_receipt import get_gl_entries from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry +from erpnext.tests.utils import ERPNextTestSuite def create_product_bundle( @@ -40,7 +40,7 @@ def create_product_bundle( return bundle, components -class TestPackedItem(IntegrationTestCase): +class TestPackedItem(ERPNextTestSuite): "Test impact on Packed Items table in various scenarios." @classmethod @@ -116,7 +116,7 @@ class TestPackedItem(IntegrationTestCase): self.assertEqual(so.packed_items[1].qty, 4) self.assertEqual(so.packed_items[3].qty, 12) - @IntegrationTestCase.change_settings("Selling Settings", {"editable_bundle_item_rates": 1}) + @ERPNextTestSuite.change_settings("Selling Settings", {"editable_bundle_item_rates": 1}) def test_bundle_item_cumulative_price(self): "Test if Bundle Item rate is cumulative from packed items." so = make_sales_order(item_code=self.bundle, qty=2, do_not_submit=True) diff --git a/erpnext/stock/doctype/packing_slip/test_packing_slip.py b/erpnext/stock/doctype/packing_slip/test_packing_slip.py index 8d16b2d8fe0..19e6c976edc 100644 --- a/erpnext/stock/doctype/packing_slip/test_packing_slip.py +++ b/erpnext/stock/doctype/packing_slip/test_packing_slip.py @@ -3,15 +3,15 @@ import frappe -from frappe.tests import IntegrationTestCase from erpnext.selling.doctype.product_bundle.test_product_bundle import make_product_bundle from erpnext.stock.doctype.delivery_note.delivery_note import make_packing_slip 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.tests.utils import ERPNextTestSuite -class TestPackingSlip(IntegrationTestCase): +class TestPackingSlip(ERPNextTestSuite): def test_packing_slip(self): # Step - 1: Create a Product Bundle items = create_items() diff --git a/erpnext/stock/doctype/pick_list/test_pick_list.py b/erpnext/stock/doctype/pick_list/test_pick_list.py index 0bd66b69afe..bf8d2ef5af1 100644 --- a/erpnext/stock/doctype/pick_list/test_pick_list.py +++ b/erpnext/stock/doctype/pick_list/test_pick_list.py @@ -3,7 +3,6 @@ import frappe from frappe import _dict -from frappe.tests import IntegrationTestCase from erpnext.selling.doctype.product_bundle.test_product_bundle import make_product_bundle from erpnext.selling.doctype.sales_order.sales_order import create_pick_list @@ -21,9 +20,10 @@ from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry from erpnext.stock.doctype.stock_reconciliation.stock_reconciliation import ( EmptyStockReconciliationItemsError, ) +from erpnext.tests.utils import ERPNextTestSuite -class TestPickList(IntegrationTestCase): +class TestPickList(ERPNextTestSuite): def test_pick_list_picks_warehouse_for_each_item(self): item_code = make_item().name try: diff --git a/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py index a3ead18cb6c..1ca15a3af43 100644 --- a/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py +++ b/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py @@ -2,7 +2,6 @@ # License: GNU General Public License v3. See license.txt import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import add_days, cint, cstr, flt, get_datetime, getdate, nowtime, today from pypika import functions as fn @@ -26,9 +25,10 @@ from erpnext.stock.doctype.serial_and_batch_bundle.test_serial_and_batch_bundle make_serial_batch_bundle, ) from erpnext.stock.doctype.warehouse.test_warehouse import create_warehouse +from erpnext.tests.utils import ERPNextTestSuite -class TestPurchaseReceipt(IntegrationTestCase): +class TestPurchaseReceipt(ERPNextTestSuite): def setUp(self): frappe.db.set_single_value("Buying Settings", "allow_multiple_items", 1) @@ -1301,7 +1301,7 @@ class TestPurchaseReceipt(IntegrationTestCase): self.assertEqual(discrepancy_caused_by_exchange_rate_diff, amount) - @IntegrationTestCase.change_settings("Accounts Settings", {"automatically_fetch_payment_terms": 1}) + @ERPNextTestSuite.change_settings("Accounts Settings", {"automatically_fetch_payment_terms": 1}) def test_payment_terms_are_fetched_when_creating_purchase_invoice(self): from erpnext.accounts.doctype.payment_entry.test_payment_entry import ( create_payment_terms_template, @@ -1332,7 +1332,7 @@ class TestPurchaseReceipt(IntegrationTestCase): # self.assertEqual(po.payment_terms_template, pi.payment_terms_template) compare_payment_schedules(self, po, pi) - @IntegrationTestCase.change_settings("Stock Settings", {"allow_negative_stock": 1}) + @ERPNextTestSuite.change_settings("Stock Settings", {"allow_negative_stock": 1}) def test_neg_to_positive(self): from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry @@ -4458,7 +4458,7 @@ class TestPurchaseReceipt(IntegrationTestCase): frappe.db.set_single_value("Buying Settings", "set_valuation_rate_for_rejected_materials", 0) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Buying Settings", {"bill_for_rejected_quantity_in_purchase_invoice": 1, "set_valuation_rate_for_rejected_materials": 1}, ) @@ -4816,7 +4816,7 @@ class TestPurchaseReceipt(IntegrationTestCase): self.assertEqual(sles, [1500.0, 1500.0]) - @IntegrationTestCase.change_settings("Stock Settings", {"allow_negative_stock": 0}) + @ERPNextTestSuite.change_settings("Stock Settings", {"allow_negative_stock": 0}) def test_multiple_transactions_with_same_posting_datetime(self): from erpnext.stock.doctype.delivery_note.test_delivery_note import create_delivery_note from erpnext.stock.stock_ledger import NegativeStockError @@ -4851,7 +4851,7 @@ class TestPurchaseReceipt(IntegrationTestCase): self.assertRaises(NegativeStockError, pr.cancel) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Buying Settings", {"set_landed_cost_based_on_purchase_invoice_rate": 1, "maintain_same_rate": 0} ) def test_set_lcv_from_pi_created_against_po(self): diff --git a/erpnext/stock/doctype/putaway_rule/test_putaway_rule.py b/erpnext/stock/doctype/putaway_rule/test_putaway_rule.py index df285665a38..257bd595b68 100644 --- a/erpnext/stock/doctype/putaway_rule/test_putaway_rule.py +++ b/erpnext/stock/doctype/putaway_rule/test_putaway_rule.py @@ -2,7 +2,6 @@ # See license.txt import frappe -from frappe.tests import IntegrationTestCase from erpnext.stock.doctype.batch.test_batch import make_new_batch from erpnext.stock.doctype.item.test_item import make_item @@ -14,9 +13,10 @@ from erpnext.stock.doctype.serial_and_batch_bundle.test_serial_and_batch_bundle from erpnext.stock.doctype.stock_entry.test_stock_entry import make_stock_entry from erpnext.stock.doctype.warehouse.test_warehouse import create_warehouse from erpnext.stock.get_item_details import get_conversion_factor +from erpnext.tests.utils import ERPNextTestSuite -class TestPutawayRule(IntegrationTestCase): +class TestPutawayRule(ERPNextTestSuite): def setUp(self): if not frappe.db.exists("Item", "_Rice"): make_item( diff --git a/erpnext/stock/doctype/quality_inspection/test_quality_inspection.py b/erpnext/stock/doctype/quality_inspection/test_quality_inspection.py index 3885df7c74a..34b140515f2 100644 --- a/erpnext/stock/doctype/quality_inspection/test_quality_inspection.py +++ b/erpnext/stock/doctype/quality_inspection/test_quality_inspection.py @@ -2,7 +2,6 @@ # See license.txt import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import nowdate from erpnext.controllers.stock_controller import ( @@ -14,9 +13,10 @@ from erpnext.controllers.stock_controller import ( from erpnext.stock.doctype.delivery_note.test_delivery_note import create_delivery_note from erpnext.stock.doctype.item.test_item import create_item from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry +from erpnext.tests.utils import ERPNextTestSuite -class TestQualityInspection(IntegrationTestCase): +class TestQualityInspection(ERPNextTestSuite): def setUp(self): super().setUp() create_item("_Test Item with QA") @@ -218,7 +218,7 @@ class TestQualityInspection(IntegrationTestCase): qa.save() self.assertEqual(qa.status, "Accepted") - @IntegrationTestCase.change_settings("System Settings", {"number_format": "#.###,##"}) + @ERPNextTestSuite.change_settings("System Settings", {"number_format": "#.###,##"}) def test_diff_number_format(self): self.assertEqual(frappe.db.get_default("number_format"), "#.###,##") # sanity check diff --git a/erpnext/stock/doctype/quality_inspection_parameter/test_quality_inspection_parameter.py b/erpnext/stock/doctype/quality_inspection_parameter/test_quality_inspection_parameter.py index 8b85e5681c7..73dd8e5cd9f 100644 --- a/erpnext/stock/doctype/quality_inspection_parameter/test_quality_inspection_parameter.py +++ b/erpnext/stock/doctype/quality_inspection_parameter/test_quality_inspection_parameter.py @@ -3,8 +3,8 @@ # import frappe import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestQualityInspectionParameter(IntegrationTestCase): +class TestQualityInspectionParameter(ERPNextTestSuite): pass diff --git a/erpnext/stock/doctype/quality_inspection_parameter_group/test_quality_inspection_parameter_group.py b/erpnext/stock/doctype/quality_inspection_parameter_group/test_quality_inspection_parameter_group.py index d3c158676a5..4a468b80182 100644 --- a/erpnext/stock/doctype/quality_inspection_parameter_group/test_quality_inspection_parameter_group.py +++ b/erpnext/stock/doctype/quality_inspection_parameter_group/test_quality_inspection_parameter_group.py @@ -3,8 +3,8 @@ # import frappe import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestQualityInspectionParameterGroup(IntegrationTestCase): +class TestQualityInspectionParameterGroup(ERPNextTestSuite): pass diff --git a/erpnext/stock/doctype/quality_inspection_template/test_quality_inspection_template.py b/erpnext/stock/doctype/quality_inspection_template/test_quality_inspection_template.py index 9094ac1d8a0..5a69de5264a 100644 --- a/erpnext/stock/doctype/quality_inspection_template/test_quality_inspection_template.py +++ b/erpnext/stock/doctype/quality_inspection_template/test_quality_inspection_template.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestQualityInspectionTemplate(IntegrationTestCase): +class TestQualityInspectionTemplate(ERPNextTestSuite): pass diff --git a/erpnext/stock/doctype/repost_item_valuation/test_repost_item_valuation.py b/erpnext/stock/doctype/repost_item_valuation/test_repost_item_valuation.py index d4a8dc24c52..45d8d0ebcb5 100644 --- a/erpnext/stock/doctype/repost_item_valuation/test_repost_item_valuation.py +++ b/erpnext/stock/doctype/repost_item_valuation/test_repost_item_valuation.py @@ -5,7 +5,6 @@ from unittest.mock import MagicMock, call import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import add_days, add_to_date, now, nowdate, today from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice @@ -19,9 +18,10 @@ from erpnext.stock.doctype.repost_item_valuation.repost_item_valuation import ( from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry from erpnext.stock.tests.test_utils import StockTestMixin from erpnext.stock.utils import PendingRepostingError +from erpnext.tests.utils import ERPNextTestSuite -class TestRepostItemValuation(IntegrationTestCase, StockTestMixin): +class TestRepostItemValuation(ERPNextTestSuite, StockTestMixin): def tearDown(self): frappe.flags.dont_execute_stock_reposts = False @@ -195,7 +195,7 @@ class TestRepostItemValuation(IntegrationTestCase, StockTestMixin): riv.set_status("Skipped") - @IntegrationTestCase.change_settings("Stock Reposting Settings", {"item_based_reposting": 0}) + @ERPNextTestSuite.change_settings("Stock Reposting Settings", {"item_based_reposting": 0}) def test_prevention_of_cancelled_transaction_riv(self): frappe.flags.dont_execute_stock_reposts = True @@ -374,7 +374,7 @@ class TestRepostItemValuation(IntegrationTestCase, StockTestMixin): company.accounts_frozen_till_date = "" company.save() - @IntegrationTestCase.change_settings("Stock Reposting Settings", {"item_based_reposting": 0}) + @ERPNextTestSuite.change_settings("Stock Reposting Settings", {"item_based_reposting": 0}) def test_create_repost_entry_for_cancelled_document(self): pr = make_purchase_receipt( company="_Test Company with perpetual inventory", diff --git a/erpnext/stock/doctype/serial_and_batch_bundle/test_serial_and_batch_bundle.py b/erpnext/stock/doctype/serial_and_batch_bundle/test_serial_and_batch_bundle.py index d02affd68f0..5a34b4715dc 100644 --- a/erpnext/stock/doctype/serial_and_batch_bundle/test_serial_and_batch_bundle.py +++ b/erpnext/stock/doctype/serial_and_batch_bundle/test_serial_and_batch_bundle.py @@ -4,7 +4,6 @@ import json import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import flt, nowtime, today from erpnext.stock.doctype.item.test_item import make_item @@ -15,9 +14,10 @@ from erpnext.stock.doctype.serial_and_batch_bundle.serial_and_batch_bundle impor make_serial_nos, ) from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry +from erpnext.tests.utils import ERPNextTestSuite -class TestSerialandBatchBundle(IntegrationTestCase): +class TestSerialandBatchBundle(ERPNextTestSuite): def test_naming_for_sabb(self): frappe.db.set_single_value( "Stock Settings", "set_serial_and_batch_bundle_naming_based_on_naming_series", 1 @@ -769,7 +769,7 @@ class TestSerialandBatchBundle(IntegrationTestCase): make_serial_nos(item_code, serial_nos) self.assertTrue(frappe.db.exists("Serial No", serial_no_id)) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Stock Settings", {"auto_create_serial_and_batch_bundle_for_outward": 1} ) def test_duplicate_serial_and_batch_bundle(self): diff --git a/erpnext/stock/doctype/serial_no/test_serial_no.py b/erpnext/stock/doctype/serial_no/test_serial_no.py index dfc2a1edd6d..f9b17998bf1 100644 --- a/erpnext/stock/doctype/serial_no/test_serial_no.py +++ b/erpnext/stock/doctype/serial_no/test_serial_no.py @@ -7,7 +7,6 @@ import frappe from frappe import _dict -from frappe.tests import IntegrationTestCase from erpnext.stock.doctype.delivery_note.test_delivery_note import create_delivery_note from erpnext.stock.doctype.item.test_item import make_item @@ -20,9 +19,10 @@ from erpnext.stock.doctype.serial_no.serial_no import * from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry from erpnext.stock.doctype.stock_entry.test_stock_entry import make_serialized_item from erpnext.stock.doctype.warehouse.test_warehouse import create_warehouse +from erpnext.tests.utils import ERPNextTestSuite -class TestSerialNo(IntegrationTestCase): +class TestSerialNo(ERPNextTestSuite): def tearDown(self): frappe.db.rollback() diff --git a/erpnext/stock/doctype/shipment/test_shipment.py b/erpnext/stock/doctype/shipment/test_shipment.py index 4a26107524e..7e58f942faf 100644 --- a/erpnext/stock/doctype/shipment/test_shipment.py +++ b/erpnext/stock/doctype/shipment/test_shipment.py @@ -4,12 +4,12 @@ from datetime import date, timedelta import frappe -from frappe.tests import IntegrationTestCase from erpnext.stock.doctype.delivery_note.delivery_note import make_shipment +from erpnext.tests.utils import ERPNextTestSuite -class TestShipment(IntegrationTestCase): +class TestShipment(ERPNextTestSuite): def test_shipment_from_delivery_note(self): delivery_note = create_test_delivery_note() delivery_note.submit() diff --git a/erpnext/stock/doctype/shipment_parcel_template/test_shipment_parcel_template.py b/erpnext/stock/doctype/shipment_parcel_template/test_shipment_parcel_template.py index 81f8f4393bc..04c1403cb30 100644 --- a/erpnext/stock/doctype/shipment_parcel_template/test_shipment_parcel_template.py +++ b/erpnext/stock/doctype/shipment_parcel_template/test_shipment_parcel_template.py @@ -3,8 +3,8 @@ # import frappe import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestShipmentParcelTemplate(IntegrationTestCase): +class TestShipmentParcelTemplate(ERPNextTestSuite): pass diff --git a/erpnext/stock/doctype/stock_closing_balance/test_stock_closing_balance.py b/erpnext/stock/doctype/stock_closing_balance/test_stock_closing_balance.py index 2d0769cf496..e60ffc118fa 100644 --- a/erpnext/stock/doctype/stock_closing_balance/test_stock_closing_balance.py +++ b/erpnext/stock/doctype/stock_closing_balance/test_stock_closing_balance.py @@ -2,14 +2,14 @@ # See license.txt # import frappe -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -# On IntegrationTestCase, the doctype test records and all +# On ERPNextTestSuite, the doctype test records and all # link-field test record depdendencies are recursively loaded # Use these module variables to add/remove to/from that list -class IntegrationTestStockClosingBalance(IntegrationTestCase): +class TestStockClosingBalance(ERPNextTestSuite): """ Integration tests for StockClosingBalance. Use this class for testing interactions between multiple components. diff --git a/erpnext/stock/doctype/stock_closing_entry/test_stock_closing_entry.py b/erpnext/stock/doctype/stock_closing_entry/test_stock_closing_entry.py index db4577503e6..91d3f3d7b34 100644 --- a/erpnext/stock/doctype/stock_closing_entry/test_stock_closing_entry.py +++ b/erpnext/stock/doctype/stock_closing_entry/test_stock_closing_entry.py @@ -2,14 +2,15 @@ # See license.txt # import frappe -from frappe.tests import IntegrationTestCase -# On IntegrationTestCase, the doctype test records and all +from erpnext.tests.utils import ERPNextTestSuite + +# On ERPNextTestSuite, the doctype test records and all # link-field test record depdendencies are recursively loaded # Use these module variables to add/remove to/from that list -class IntegrationTestStockClosingEntry(IntegrationTestCase): +class TestStockClosingEntry(ERPNextTestSuite): """ Integration tests for StockClosingEntry. Use this class for testing interactions between multiple components. diff --git a/erpnext/stock/doctype/stock_entry/test_stock_entry.py b/erpnext/stock/doctype/stock_entry/test_stock_entry.py index 583cb4bedc6..967d473a030 100644 --- a/erpnext/stock/doctype/stock_entry/test_stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/test_stock_entry.py @@ -3,7 +3,6 @@ from frappe.permissions import add_user_permission, remove_user_permission -from frappe.tests import IntegrationTestCase from frappe.utils import add_days, cstr, flt, get_time, getdate, nowtime, today from erpnext.accounts.doctype.account.test_account import get_inventory_account @@ -38,6 +37,7 @@ from erpnext.stock.doctype.stock_reconciliation.test_stock_reconciliation import ) from erpnext.stock.serial_batch_bundle import SerialBatchCreation from erpnext.stock.stock_ledger import NegativeStockError, get_previous_sle +from erpnext.tests.utils import ERPNextTestSuite def get_sle(**args): @@ -56,7 +56,7 @@ def get_sle(**args): ) -class TestStockEntry(IntegrationTestCase): +class TestStockEntry(ERPNextTestSuite): def tearDown(self): frappe.db.rollback() frappe.set_user("Administrator") @@ -866,7 +866,7 @@ class TestStockEntry(IntegrationTestCase): fg_cost = next(filter(lambda x: x.item_code == "_Test FG Item 2", stock_entry.get("items"))).amount self.assertEqual(fg_cost, flt(rm_cost + bom_operation_cost + work_order.additional_operating_cost, 2)) - @IntegrationTestCase.change_settings("Manufacturing Settings", {"material_consumption": 1}) + @ERPNextTestSuite.change_settings("Manufacturing Settings", {"material_consumption": 1}) def test_work_order_manufacture_with_material_consumption(self): from erpnext.manufacturing.doctype.work_order.work_order import ( make_stock_entry as _make_stock_entry, @@ -1293,7 +1293,7 @@ class TestStockEntry(IntegrationTestCase): self.assertEqual(se.items[0].expense_account, "_Test Account Cost for Goods Sold - _TC") self.assertEqual(se.items[1].expense_account, "_Test Account Cost for Goods Sold - _TC") - @IntegrationTestCase.change_settings("Stock Settings", {"allow_negative_stock": 0}) + @ERPNextTestSuite.change_settings("Stock Settings", {"allow_negative_stock": 0}) def test_future_negative_sle(self): # Initialize item, batch, warehouse, opening qty item_code = "_Test Future Neg Item" @@ -1336,7 +1336,7 @@ class TestStockEntry(IntegrationTestCase): self.assertRaises(NegativeStockError, create_stock_entries, sequence_of_entries) - @IntegrationTestCase.change_settings("Stock Settings", {"allow_negative_stock": 0}) + @ERPNextTestSuite.change_settings("Stock Settings", {"allow_negative_stock": 0}) def test_future_negative_sle_batch(self): from erpnext.stock.doctype.batch.test_batch import TestBatch @@ -1464,7 +1464,7 @@ class TestStockEntry(IntegrationTestCase): self.assertEqual(se.items[0].item_name, item.item_name) self.assertEqual(se.items[0].stock_uom, item.stock_uom) - @IntegrationTestCase.change_settings("Stock Reposting Settings", {"item_based_reposting": 0}) + @ERPNextTestSuite.change_settings("Stock Reposting Settings", {"item_based_reposting": 0}) def test_reposting_for_depedent_warehouse(self): from erpnext.stock.doctype.repost_item_valuation.repost_item_valuation import repost_sl_entries from erpnext.stock.doctype.warehouse.test_warehouse import create_warehouse @@ -2326,7 +2326,7 @@ class TestStockEntry(IntegrationTestCase): se.save() se.submit() - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Stock Settings", {"sample_retention_warehouse": "_Test Warehouse 1 - _TC"} ) def test_sample_retention_stock_entry(self): @@ -2388,7 +2388,7 @@ class TestStockEntry(IntegrationTestCase): frappe.db.set_single_value("Manufacturing Settings", "material_consumption", original_value) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Manufacturing Settings", { "material_consumption": 1, diff --git a/erpnext/stock/doctype/stock_entry_type/test_stock_entry_type.py b/erpnext/stock/doctype/stock_entry_type/test_stock_entry_type.py index 2ffeaed47f5..5b661957d0b 100644 --- a/erpnext/stock/doctype/stock_entry_type/test_stock_entry_type.py +++ b/erpnext/stock/doctype/stock_entry_type/test_stock_entry_type.py @@ -3,10 +3,11 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase + +from erpnext.tests.utils import ERPNextTestSuite -class TestStockEntryType(IntegrationTestCase): +class TestStockEntryType(ERPNextTestSuite): def test_stock_entry_type_non_standard(self): stock_entry_type = "Test Manufacturing" diff --git a/erpnext/stock/doctype/stock_ledger_entry/test_stock_ledger_entry.py b/erpnext/stock/doctype/stock_ledger_entry/test_stock_ledger_entry.py index c0ea44c59d5..8c8e3fee920 100644 --- a/erpnext/stock/doctype/stock_ledger_entry/test_stock_ledger_entry.py +++ b/erpnext/stock/doctype/stock_ledger_entry/test_stock_ledger_entry.py @@ -9,7 +9,6 @@ import frappe from frappe.core.page.permission_manager.permission_manager import reset from frappe.custom.doctype.property_setter.property_setter import make_property_setter from frappe.query_builder.functions import Timestamp -from frappe.tests import IntegrationTestCase from frappe.utils import add_days, add_to_date, flt, today from erpnext.accounts.doctype.gl_entry.gl_entry import rename_gle_sle_docs @@ -29,9 +28,10 @@ from erpnext.stock.doctype.stock_reconciliation.test_stock_reconciliation import ) from erpnext.stock.stock_ledger import get_previous_sle from erpnext.stock.tests.test_utils import StockTestMixin +from erpnext.tests.utils import ERPNextTestSuite -class TestStockLedgerEntry(IntegrationTestCase, StockTestMixin): +class TestStockLedgerEntry(ERPNextTestSuite, StockTestMixin): def setUp(self): items = create_items() reset("Stock Entry") @@ -1256,7 +1256,7 @@ class TestStockLedgerEntry(IntegrationTestCase, StockTestMixin): self.assertEqual(sle[0].qty_after_transaction, 105) self.assertEqual(sle[0].actual_qty, 100) - @IntegrationTestCase.change_settings("System Settings", {"float_precision": 3, "currency_precision": 2}) + @ERPNextTestSuite.change_settings("System Settings", {"float_precision": 3, "currency_precision": 2}) def test_transfer_invariants(self): """Extact stock value should be transferred.""" @@ -1295,7 +1295,7 @@ class TestStockLedgerEntry(IntegrationTestCase, StockTestMixin): ) self.assertEqual(abs(sles[0].stock_value_difference), sles[1].stock_value_difference) - @IntegrationTestCase.change_settings("System Settings", {"float_precision": 4}) + @ERPNextTestSuite.change_settings("System Settings", {"float_precision": 4}) def test_negative_qty_with_precision(self): "Test if system precision is respected while validating negative qty." from erpnext.stock.doctype.item.test_item import create_item @@ -1335,7 +1335,7 @@ class TestStockLedgerEntry(IntegrationTestCase, StockTestMixin): self.assertEqual(flt(get_stock_balance(item_code, warehouse), 3), 0.000) - @IntegrationTestCase.change_settings("System Settings", {"float_precision": 4}) + @ERPNextTestSuite.change_settings("System Settings", {"float_precision": 4}) def test_future_negative_qty_with_precision(self): """ Ledger: @@ -1592,8 +1592,6 @@ def get_unique_suffix(): # tests to prevent future tests from failing. return str(uuid4())[:8].upper() - -class TestDeferredNaming(IntegrationTestCase): @classmethod def setUpClass(cls) -> None: super().setUpClass() diff --git a/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py b/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py index 7cc6d4b484b..41e02cc4e33 100644 --- a/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py +++ b/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py @@ -7,7 +7,6 @@ import json import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import add_days, cstr, flt, nowdate, nowtime from erpnext.accounts.utils import get_stock_and_account_balance @@ -31,9 +30,10 @@ from erpnext.stock.utils import ( get_stock_value_on, get_valuation_method, ) +from erpnext.tests.utils import ERPNextTestSuite -class TestStockReconciliation(IntegrationTestCase, StockTestMixin): +class TestStockReconciliation(ERPNextTestSuite, StockTestMixin): @classmethod def setUpClass(cls): create_batch_or_serial_no_items() @@ -50,7 +50,7 @@ class TestStockReconciliation(IntegrationTestCase, StockTestMixin): def test_reco_for_moving_average(self): self._test_reco_sle_gle("Moving Average") - @IntegrationTestCase.change_settings("Stock Settings", {"allow_negative_stock": 1}) + @ERPNextTestSuite.change_settings("Stock Settings", {"allow_negative_stock": 1}) def _test_reco_sle_gle(self, valuation_method): item_code = self.make_item(properties={"valuation_method": valuation_method}).name @@ -423,7 +423,7 @@ class TestStockReconciliation(IntegrationTestCase, StockTestMixin): assertBalance(pr2, 11) assertBalance(sr4, 6) # check if future stock reco is unaffected - @IntegrationTestCase.change_settings("Stock Settings", {"allow_negative_stock": 0}) + @ERPNextTestSuite.change_settings("Stock Settings", {"allow_negative_stock": 0}) def test_backdated_stock_reco_future_negative_stock(self): """ Test if a backdated stock reco causes future negative stock and is blocked. @@ -472,7 +472,7 @@ class TestStockReconciliation(IntegrationTestCase, StockTestMixin): dn2.cancel() pr1.cancel() - @IntegrationTestCase.change_settings("Stock Settings", {"allow_negative_stock": 0}) + @ERPNextTestSuite.change_settings("Stock Settings", {"allow_negative_stock": 0}) def test_backdated_stock_reco_cancellation_future_negative_stock(self): """ Test if a backdated stock reco cancellation that causes future negative stock is blocked. @@ -678,7 +678,7 @@ class TestStockReconciliation(IntegrationTestCase, StockTestMixin): self.assertEqual(flt(sl_entry.actual_qty), 1.0) self.assertEqual(flt(sl_entry.qty_after_transaction), 1.0) - @IntegrationTestCase.change_settings("Stock Reposting Settings", {"item_based_reposting": 0}) + @ERPNextTestSuite.change_settings("Stock Reposting Settings", {"item_based_reposting": 0}) def test_backdated_stock_reco_entry(self): from erpnext.stock.doctype.stock_entry.test_stock_entry import make_stock_entry diff --git a/erpnext/stock/doctype/stock_reposting_settings/test_stock_reposting_settings.py b/erpnext/stock/doctype/stock_reposting_settings/test_stock_reposting_settings.py index 74cf9f08b77..ff89ad34ab6 100644 --- a/erpnext/stock/doctype/stock_reposting_settings/test_stock_reposting_settings.py +++ b/erpnext/stock/doctype/stock_reposting_settings/test_stock_reposting_settings.py @@ -3,12 +3,12 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from erpnext.stock.doctype.repost_item_valuation.repost_item_valuation import get_recipients +from erpnext.tests.utils import ERPNextTestSuite -class TestStockRepostingSettings(IntegrationTestCase): +class TestStockRepostingSettings(ERPNextTestSuite): def test_notify_reposting_error_to_role(self): role = "Notify Reposting Role" diff --git a/erpnext/stock/doctype/stock_reservation_entry/test_stock_reservation_entry.py b/erpnext/stock/doctype/stock_reservation_entry/test_stock_reservation_entry.py index aa49726374a..bd59b5dc975 100644 --- a/erpnext/stock/doctype/stock_reservation_entry/test_stock_reservation_entry.py +++ b/erpnext/stock/doctype/stock_reservation_entry/test_stock_reservation_entry.py @@ -4,8 +4,7 @@ from random import randint import frappe -from frappe.tests import IntegrationTestCase -from frappe.utils import cint, today +from frappe.utils import today from erpnext.selling.doctype.sales_order.sales_order import create_pick_list, make_delivery_note from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order @@ -19,15 +18,16 @@ from erpnext.stock.doctype.stock_reservation_entry.stock_reservation_entry impor has_reserved_stock, ) from erpnext.stock.utils import get_stock_balance +from erpnext.tests.utils import ERPNextTestSuite -class TestStockReservationEntry(IntegrationTestCase): +class TestStockReservationEntry(ERPNextTestSuite): def setUp(self) -> None: self.warehouse = "_Test Warehouse - _TC" self.sr_item = make_item(properties={"is_stock_item": 1, "valuation_rate": 100}) create_material_receipt(items={self.sr_item.name: self.sr_item}, warehouse=self.warehouse, qty=100) - @IntegrationTestCase.change_settings("Stock Settings", {"allow_negative_stock": 0}) + @ERPNextTestSuite.change_settings("Stock Settings", {"allow_negative_stock": 0}) def test_validate_stock_reservation_settings(self) -> None: from erpnext.stock.doctype.stock_reservation_entry.stock_reservation_entry import ( validate_stock_reservation_settings, @@ -120,7 +120,7 @@ class TestStockReservationEntry(IntegrationTestCase): sre.load_from_db() self.assertEqual(sre.status, "Cancelled") - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Stock Settings", {"allow_negative_stock": 0, "enable_stock_reservation": 1} ) def test_update_reserved_qty_in_voucher(self) -> None: @@ -189,7 +189,7 @@ class TestStockReservationEntry(IntegrationTestCase): self.assertEqual(sre1.status, "Cancelled") self.assertEqual(so.items[0].stock_reserved_qty, 0) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Stock Settings", {"allow_negative_stock": 0, "enable_stock_reservation": 1} ) def test_cant_consume_reserved_stock(self) -> None: @@ -239,7 +239,7 @@ class TestStockReservationEntry(IntegrationTestCase): se.submit() se.cancel() - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Stock Settings", { "allow_negative_stock": 0, @@ -382,7 +382,7 @@ class TestStockReservationEntry(IntegrationTestCase): for sre_detail in sre_details: self.assertEqual(sre_detail.reserved_qty, sre_detail.delivered_qty) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Stock Settings", { "allow_negative_stock": 0, @@ -502,7 +502,7 @@ class TestStockReservationEntry(IntegrationTestCase): # Test - 9: After Delivery Note cancellation, SB Entry Delivered Qty should be `0`. self.assertEqual(sb_entry.delivered_qty, 0) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Stock Settings", { "allow_negative_stock": 0, @@ -583,7 +583,7 @@ class TestStockReservationEntry(IntegrationTestCase): # Test - 3: Reserved Serial/Batch Nos should be equal to Picked Serial/Batch Nos. self.assertSetEqual(picked_sb_details, reserved_sb_details) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Stock Settings", { "allow_negative_stock": 0, @@ -663,7 +663,7 @@ class TestStockReservationEntry(IntegrationTestCase): # Test - 3: Reserved Serial/Batch Nos should be equal to PR Item Serial/Batch Nos. self.assertEqual(set(sb_details), set(reserved_sb_details)) - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Stock Settings", { "allow_negative_stock": 0, diff --git a/erpnext/stock/doctype/stock_settings/test_stock_settings.py b/erpnext/stock/doctype/stock_settings/test_stock_settings.py index 18c523f9998..112fa52401d 100644 --- a/erpnext/stock/doctype/stock_settings/test_stock_settings.py +++ b/erpnext/stock/doctype/stock_settings/test_stock_settings.py @@ -3,10 +3,11 @@ import frappe -from frappe.tests import IntegrationTestCase + +from erpnext.tests.utils import ERPNextTestSuite -class TestStockSettings(IntegrationTestCase): +class TestStockSettings(ERPNextTestSuite): def setUp(self): super().setUp() frappe.db.set_single_value("Stock Settings", "clean_description_html", 0) diff --git a/erpnext/stock/doctype/uom_category/test_uom_category.py b/erpnext/stock/doctype/uom_category/test_uom_category.py index ebd2b5644c0..e664222da43 100644 --- a/erpnext/stock/doctype/uom_category/test_uom_category.py +++ b/erpnext/stock/doctype/uom_category/test_uom_category.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestUOMCategory(IntegrationTestCase): +class TestUOMCategory(ERPNextTestSuite): pass diff --git a/erpnext/stock/doctype/variant_field/test_variant_field.py b/erpnext/stock/doctype/variant_field/test_variant_field.py index ab35caf96b8..c63f8f1702b 100644 --- a/erpnext/stock/doctype/variant_field/test_variant_field.py +++ b/erpnext/stock/doctype/variant_field/test_variant_field.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestVariantField(IntegrationTestCase): +class TestVariantField(ERPNextTestSuite): pass diff --git a/erpnext/stock/doctype/warehouse/test_warehouse.py b/erpnext/stock/doctype/warehouse/test_warehouse.py index fc5feff5812..5a36d5c213e 100644 --- a/erpnext/stock/doctype/warehouse/test_warehouse.py +++ b/erpnext/stock/doctype/warehouse/test_warehouse.py @@ -2,16 +2,16 @@ # License: GNU General Public License v3. See license.txt import frappe -from frappe.tests import IntegrationTestCase import erpnext from erpnext.accounts.doctype.account.test_account import create_account from erpnext.stock.doctype.item.test_item import create_item from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry from erpnext.stock.doctype.warehouse.warehouse import convert_to_group_or_ledger, get_children +from erpnext.tests.utils import ERPNextTestSuite -class TestWarehouse(IntegrationTestCase): +class TestWarehouse(ERPNextTestSuite): def test_parent_warehouse(self): parent_warehouse = frappe.get_doc("Warehouse", "_Test Warehouse Group - _TC") self.assertEqual(parent_warehouse.is_group, 1) diff --git a/erpnext/stock/doctype/warehouse_type/test_warehouse_type.py b/erpnext/stock/doctype/warehouse_type/test_warehouse_type.py index 4afa82219cb..ce06e4356e2 100644 --- a/erpnext/stock/doctype/warehouse_type/test_warehouse_type.py +++ b/erpnext/stock/doctype/warehouse_type/test_warehouse_type.py @@ -3,8 +3,8 @@ # import frappe import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestWarehouseType(IntegrationTestCase): +class TestWarehouseType(ERPNextTestSuite): pass diff --git a/erpnext/stock/report/available_serial_no/test_available_serial_no.py b/erpnext/stock/report/available_serial_no/test_available_serial_no.py index b8741af4506..a1ec59da78f 100644 --- a/erpnext/stock/report/available_serial_no/test_available_serial_no.py +++ b/erpnext/stock/report/available_serial_no/test_available_serial_no.py @@ -2,15 +2,15 @@ # See license.txt import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import add_days, today from erpnext.stock.doctype.delivery_note.test_delivery_note import create_delivery_note from erpnext.stock.doctype.item.test_item import create_item from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import make_purchase_receipt +from erpnext.tests.utils import ERPNextTestSuite -class TestStockLedgerReeport(IntegrationTestCase): +class TestStockLedgerReeport(ERPNextTestSuite): def setUp(self) -> None: item = create_item("_Test Item with Serial No", is_stock_item=1) item.has_serial_no = 1 diff --git a/erpnext/stock/report/item_shortage_report/test_item_shortage_report.py b/erpnext/stock/report/item_shortage_report/test_item_shortage_report.py index 76549a14927..2a61fbf1f32 100644 --- a/erpnext/stock/report/item_shortage_report/test_item_shortage_report.py +++ b/erpnext/stock/report/item_shortage_report/test_item_shortage_report.py @@ -2,16 +2,16 @@ # For license information, please see license.txt import frappe -from frappe.tests import IntegrationTestCase from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order from erpnext.stock.doctype.item.test_item import make_item from erpnext.stock.report.item_shortage_report.item_shortage_report import ( execute as item_shortage_report, ) +from erpnext.tests.utils import ERPNextTestSuite -class TestItemShortageReport(IntegrationTestCase): +class TestItemShortageReport(ERPNextTestSuite): def test_item_shortage_report(self): item = make_item().name so = make_sales_order(item_code=item) diff --git a/erpnext/stock/report/reserved_stock/test_reserved_stock.py b/erpnext/stock/report/reserved_stock/test_reserved_stock.py index cf74df5c160..8f4cc94e704 100644 --- a/erpnext/stock/report/reserved_stock/test_reserved_stock.py +++ b/erpnext/stock/report/reserved_stock/test_reserved_stock.py @@ -2,7 +2,6 @@ # See license.txt from random import randint -from frappe.tests import IntegrationTestCase from frappe.utils.data import today from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order @@ -12,9 +11,10 @@ from erpnext.stock.doctype.stock_reservation_entry.test_stock_reservation_entry create_material_receipt, ) from erpnext.stock.report.reserved_stock.reserved_stock import get_data as reserved_stock_report +from erpnext.tests.utils import ERPNextTestSuite -class TestReservedStock(IntegrationTestCase): +class TestReservedStock(ERPNextTestSuite): def setUp(self) -> None: super().setUp() self.stock_qty = 100 @@ -24,7 +24,7 @@ class TestReservedStock(IntegrationTestCase): cancel_all_stock_reservation_entries() return super().tearDown() - @IntegrationTestCase.change_settings( + @ERPNextTestSuite.change_settings( "Stock Settings", { "allow_negative_stock": 0, diff --git a/erpnext/stock/report/stock_ageing/test_stock_ageing.py b/erpnext/stock/report/stock_ageing/test_stock_ageing.py index 52d8abf0c28..4e2e5ca9d88 100644 --- a/erpnext/stock/report/stock_ageing/test_stock_ageing.py +++ b/erpnext/stock/report/stock_ageing/test_stock_ageing.py @@ -2,12 +2,12 @@ # See license.txt import frappe -from frappe.tests import IntegrationTestCase from erpnext.stock.report.stock_ageing.stock_ageing import FIFOSlots, format_report_data +from erpnext.tests.utils import ERPNextTestSuite -class TestStockAgeing(IntegrationTestCase): +class TestStockAgeing(ERPNextTestSuite): def setUp(self) -> None: self.filters = frappe._dict(company="_Test Company", to_date="2021-12-10", ranges=["30", "60", "90"]) diff --git a/erpnext/stock/report/stock_analytics/test_stock_analytics.py b/erpnext/stock/report/stock_analytics/test_stock_analytics.py index 70be5cf4e81..5603a3a111c 100644 --- a/erpnext/stock/report/stock_analytics/test_stock_analytics.py +++ b/erpnext/stock/report/stock_analytics/test_stock_analytics.py @@ -2,13 +2,13 @@ import datetime import frappe from frappe import _dict -from frappe.tests import IntegrationTestCase from frappe.utils.data import add_to_date, getdate from erpnext.accounts.utils import get_fiscal_year 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.report.stock_analytics.stock_analytics import execute, get_period_date_ranges +from erpnext.tests.utils import ERPNextTestSuite def stock_analytics(filters): @@ -16,7 +16,7 @@ def stock_analytics(filters): return col, data -class TestStockAnalyticsReport(IntegrationTestCase): +class TestStockAnalyticsReport(ERPNextTestSuite): def setUp(self) -> None: self.item = make_item().name self.warehouse = "_Test Warehouse - _TC" diff --git a/erpnext/stock/report/stock_balance/test_stock_balance.py b/erpnext/stock/report/stock_balance/test_stock_balance.py index a0176026c48..1ab36a5c011 100644 --- a/erpnext/stock/report/stock_balance/test_stock_balance.py +++ b/erpnext/stock/report/stock_balance/test_stock_balance.py @@ -2,12 +2,12 @@ from typing import Any import frappe from frappe import _dict -from frappe.tests import IntegrationTestCase from frappe.utils import today 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.report.stock_balance.stock_balance import execute +from erpnext.tests.utils import ERPNextTestSuite def stock_balance(filters): @@ -15,7 +15,7 @@ def stock_balance(filters): return [_dict(row) for row in execute(filters)[1]] -class TestStockBalance(IntegrationTestCase): +class TestStockBalance(ERPNextTestSuite): # ----------- utils def setUp(self): diff --git a/erpnext/stock/report/stock_ledger/test_stock_ledger_report.py b/erpnext/stock/report/stock_ledger/test_stock_ledger_report.py index 66e7560caa6..85abfc36ca3 100644 --- a/erpnext/stock/report/stock_ledger/test_stock_ledger_report.py +++ b/erpnext/stock/report/stock_ledger/test_stock_ledger_report.py @@ -2,15 +2,15 @@ # See license.txt import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import add_days, today from erpnext.maintenance.doctype.maintenance_schedule.test_maintenance_schedule import ( make_serial_item_with_serial, ) +from erpnext.tests.utils import ERPNextTestSuite -class TestStockLedgerReeport(IntegrationTestCase): +class TestStockLedgerReeport(ERPNextTestSuite): def setUp(self) -> None: make_serial_item_with_serial(self, "_Test Stock Report Serial Item") self.filters = frappe._dict( diff --git a/erpnext/stock/report/test_reports.py b/erpnext/stock/report/test_reports.py index 986c1404cbe..5f8aa9a32ea 100644 --- a/erpnext/stock/report/test_reports.py +++ b/erpnext/stock/report/test_reports.py @@ -1,10 +1,6 @@ -import unittest - -import frappe -from frappe.tests import IntegrationTestCase from frappe.utils.make_random import get_random -from erpnext.tests.utils import ReportFilters, ReportName, execute_script_report +from erpnext.tests.utils import ERPNextTestSuite, ReportFilters, ReportName, execute_script_report DEFAULT_FILTERS = { "company": "_Test Company", @@ -84,7 +80,7 @@ OPTIONAL_FILTERS = { } -class TestReports(IntegrationTestCase): +class TestReports(ERPNextTestSuite): def test_execute_all_stock_reports(self): """Test that all script report in stock modules are executable with supported filters""" for report, filter in REPORT_FILTER_TEST_CASES: diff --git a/erpnext/stock/tests/test_get_item_details.py b/erpnext/stock/tests/test_get_item_details.py index a10714a1f25..fdc563064ec 100644 --- a/erpnext/stock/tests/test_get_item_details.py +++ b/erpnext/stock/tests/test_get_item_details.py @@ -1,10 +1,10 @@ import frappe -from frappe.tests import IntegrationTestCase from erpnext.stock.get_item_details import get_item_details +from erpnext.tests.utils import ERPNextTestSuite -class TestGetItemDetail(IntegrationTestCase): +class TestGetItemDetail(ERPNextTestSuite): def test_get_item_detail_purchase_order(self): args = frappe._dict( { diff --git a/erpnext/stock/tests/test_utils.py b/erpnext/stock/tests/test_utils.py index 085d3d41cbe..f6625d2d93c 100644 --- a/erpnext/stock/tests/test_utils.py +++ b/erpnext/stock/tests/test_utils.py @@ -2,9 +2,9 @@ import json import frappe from frappe.query_builder.functions import Timestamp -from frappe.tests import IntegrationTestCase from erpnext.stock.utils import scan_barcode +from erpnext.tests.utils import ERPNextTestSuite class StockTestMixin: @@ -70,7 +70,7 @@ class StockTestMixin: self.assertEqual(exp_value, act_value, msg=f"{k} doesn't match \n{exp_gle}\n{act_gle}") -class TestStockUtilities(IntegrationTestCase, StockTestMixin): +class TestStockUtilities(ERPNextTestSuite, StockTestMixin): def test_barcode_scanning(self): simple_item = self.make_item(properties={"barcodes": [{"barcode": "12399"}]}) self.assertEqual(scan_barcode("12399")["item_code"], simple_item.name) diff --git a/erpnext/stock/tests/test_valuation.py b/erpnext/stock/tests/test_valuation.py index c5931c7b990..5951e9371ef 100644 --- a/erpnext/stock/tests/test_valuation.py +++ b/erpnext/stock/tests/test_valuation.py @@ -2,20 +2,20 @@ import json import unittest import frappe -from frappe.tests import IntegrationTestCase from hypothesis import given from hypothesis import strategies as st 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.valuation import FIFOValuation, LIFOValuation, round_off_if_near_zero +from erpnext.tests.utils import ERPNextTestSuite qty_gen = st.floats(min_value=-1e6, max_value=1e6) value_gen = st.floats(min_value=1, max_value=1e6) stock_queue_generator = st.lists(st.tuples(qty_gen, value_gen), min_size=10) -class TestFIFOValuation(IntegrationTestCase): +class TestFIFOValuation(ERPNextTestSuite): def setUp(self): self.queue = FIFOValuation([]) @@ -195,7 +195,7 @@ class TestFIFOValuation(IntegrationTestCase): self.assertTotalValue(total_value) -class TestLIFOValuation(IntegrationTestCase): +class TestLIFOValuation(ERPNextTestSuite): def setUp(self): self.stack = LIFOValuation([]) @@ -317,7 +317,7 @@ class TestLIFOValuation(IntegrationTestCase): self.assertTotalValue(total_value) -class TestLIFOValuationSLE(IntegrationTestCase): +class TestLIFOValuationSLE(ERPNextTestSuite): ITEM_CODE = "_Test LIFO item" WAREHOUSE = "_Test Warehouse - _TC" diff --git a/erpnext/subcontracting/doctype/subcontracting_bom/test_subcontracting_bom.py b/erpnext/subcontracting/doctype/subcontracting_bom/test_subcontracting_bom.py index a831211af93..d44603f9a0a 100644 --- a/erpnext/subcontracting/doctype/subcontracting_bom/test_subcontracting_bom.py +++ b/erpnext/subcontracting/doctype/subcontracting_bom/test_subcontracting_bom.py @@ -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 diff --git a/erpnext/subcontracting/doctype/subcontracting_inward_order/test_subcontracting_inward_order.py b/erpnext/subcontracting/doctype/subcontracting_inward_order/test_subcontracting_inward_order.py index 1d57660d6ef..9463b11bf4c 100644 --- a/erpnext/subcontracting/doctype/subcontracting_inward_order/test_subcontracting_inward_order.py +++ b/erpnext/subcontracting/doctype/subcontracting_inward_order/test_subcontracting_inward_order.py @@ -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() diff --git a/erpnext/subcontracting/doctype/subcontracting_order/test_subcontracting_order.py b/erpnext/subcontracting/doctype/subcontracting_order/test_subcontracting_order.py index 363a9cdd565..0ce5ef4216b 100644 --- a/erpnext/subcontracting/doctype/subcontracting_order/test_subcontracting_order.py +++ b/erpnext/subcontracting/doctype/subcontracting_order/test_subcontracting_order.py @@ -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() diff --git a/erpnext/subcontracting/doctype/subcontracting_receipt/test_subcontracting_receipt.py b/erpnext/subcontracting/doctype/subcontracting_receipt/test_subcontracting_receipt.py index 489f2bf82cd..6447db4ade4 100644 --- a/erpnext/subcontracting/doctype/subcontracting_receipt/test_subcontracting_receipt.py +++ b/erpnext/subcontracting/doctype/subcontracting_receipt/test_subcontracting_receipt.py @@ -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 diff --git a/erpnext/support/doctype/issue/test_issue.py b/erpnext/support/doctype/issue/test_issue.py index 92979839d1b..acb3869ce6b 100644 --- a/erpnext/support/doctype/issue/test_issue.py +++ b/erpnext/support/doctype/issue/test_issue.py @@ -5,15 +5,15 @@ import unittest import frappe from frappe import _ from frappe.core.doctype.user_permission.test_user_permission import create_user -from frappe.tests import IntegrationTestCase from frappe.utils import flt, get_datetime from erpnext.support.doctype.service_level_agreement.test_service_level_agreement import ( create_service_level_agreements_for_issues, ) +from erpnext.tests.utils import ERPNextTestSuite -class TestSetUp(IntegrationTestCase): +class TestSetUp(ERPNextTestSuite): def setUp(self): frappe.db.sql("delete from `tabService Level Agreement`") frappe.db.sql("delete from `tabService Level Priority`") diff --git a/erpnext/support/doctype/issue_priority/test_issue_priority.py b/erpnext/support/doctype/issue_priority/test_issue_priority.py index 8a7140ff3cb..df844c54a16 100644 --- a/erpnext/support/doctype/issue_priority/test_issue_priority.py +++ b/erpnext/support/doctype/issue_priority/test_issue_priority.py @@ -3,10 +3,11 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase + +from erpnext.tests.utils import ERPNextTestSuite -class TestIssuePriority(IntegrationTestCase): +class TestIssuePriority(ERPNextTestSuite): def test_priorities(self): make_priorities() priorities = frappe.get_list("Issue Priority") diff --git a/erpnext/support/doctype/issue_type/test_issue_type.py b/erpnext/support/doctype/issue_type/test_issue_type.py index 6bdc647aa3a..276db1f3661 100644 --- a/erpnext/support/doctype/issue_type/test_issue_type.py +++ b/erpnext/support/doctype/issue_type/test_issue_type.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestIssueType(IntegrationTestCase): +class TestIssueType(ERPNextTestSuite): pass diff --git a/erpnext/support/doctype/service_level_agreement/test_service_level_agreement.py b/erpnext/support/doctype/service_level_agreement/test_service_level_agreement.py index 988bd54e9f6..4ddedd1954c 100644 --- a/erpnext/support/doctype/service_level_agreement/test_service_level_agreement.py +++ b/erpnext/support/doctype/service_level_agreement/test_service_level_agreement.py @@ -4,16 +4,16 @@ import datetime import unittest import frappe -from frappe.tests import IntegrationTestCase from frappe.utils import flt from erpnext.support.doctype.issue_priority.test_issue_priority import make_priorities from erpnext.support.doctype.service_level_agreement.service_level_agreement import ( get_service_level_agreement_fields, ) +from erpnext.tests.utils import ERPNextTestSuite -class TestServiceLevelAgreement(IntegrationTestCase): +class TestServiceLevelAgreement(ERPNextTestSuite): def setUp(self): self.create_company() frappe.db.set_single_value("Support Settings", "track_service_level_agreement", 1) diff --git a/erpnext/support/doctype/support_settings/test_support_settings.py b/erpnext/support/doctype/support_settings/test_support_settings.py index 751c8d907cd..56bcd245d48 100644 --- a/erpnext/support/doctype/support_settings/test_support_settings.py +++ b/erpnext/support/doctype/support_settings/test_support_settings.py @@ -2,8 +2,8 @@ # See license.txt import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestSupportSettings(IntegrationTestCase): +class TestSupportSettings(ERPNextTestSuite): pass diff --git a/erpnext/support/doctype/warranty_claim/test_warranty_claim.py b/erpnext/support/doctype/warranty_claim/test_warranty_claim.py index ff41f36b2cd..1d5cf1f98b1 100644 --- a/erpnext/support/doctype/warranty_claim/test_warranty_claim.py +++ b/erpnext/support/doctype/warranty_claim/test_warranty_claim.py @@ -2,9 +2,8 @@ # See license.txt import unittest -import frappe -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestWarrantyClaim(IntegrationTestCase): +class TestWarrantyClaim(ERPNextTestSuite): pass diff --git a/erpnext/support/report/issue_analytics/test_issue_analytics.py b/erpnext/support/report/issue_analytics/test_issue_analytics.py index 1598ef9d295..039b8ef0551 100644 --- a/erpnext/support/report/issue_analytics/test_issue_analytics.py +++ b/erpnext/support/report/issue_analytics/test_issue_analytics.py @@ -2,7 +2,6 @@ import unittest import frappe from frappe.desk.form.assign_to import add as add_assignment -from frappe.tests import IntegrationTestCase from frappe.utils import add_months, getdate from erpnext.support.doctype.issue.test_issue import create_customer, make_issue @@ -10,11 +9,12 @@ from erpnext.support.doctype.service_level_agreement.test_service_level_agreemen create_service_level_agreements_for_issues, ) from erpnext.support.report.issue_analytics.issue_analytics import execute +from erpnext.tests.utils import ERPNextTestSuite months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"] -class TestIssueAnalytics(IntegrationTestCase): +class TestIssueAnalytics(ERPNextTestSuite): @classmethod def setUpClass(cls): super().setUpClass() diff --git a/erpnext/telephony/doctype/call_log/test_call_log.py b/erpnext/telephony/doctype/call_log/test_call_log.py index e50a13d9f9e..bed31027f01 100644 --- a/erpnext/telephony/doctype/call_log/test_call_log.py +++ b/erpnext/telephony/doctype/call_log/test_call_log.py @@ -3,8 +3,8 @@ # import frappe import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestCallLog(IntegrationTestCase): +class TestCallLog(ERPNextTestSuite): pass diff --git a/erpnext/telephony/doctype/incoming_call_settings/test_incoming_call_settings.py b/erpnext/telephony/doctype/incoming_call_settings/test_incoming_call_settings.py index 594e17e0f32..9171b30c105 100644 --- a/erpnext/telephony/doctype/incoming_call_settings/test_incoming_call_settings.py +++ b/erpnext/telephony/doctype/incoming_call_settings/test_incoming_call_settings.py @@ -3,8 +3,8 @@ # import frappe import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestIncomingCallSettings(IntegrationTestCase): +class TestIncomingCallSettings(ERPNextTestSuite): pass diff --git a/erpnext/telephony/doctype/telephony_call_type/test_telephony_call_type.py b/erpnext/telephony/doctype/telephony_call_type/test_telephony_call_type.py index 3c8e4952401..e222f866612 100644 --- a/erpnext/telephony/doctype/telephony_call_type/test_telephony_call_type.py +++ b/erpnext/telephony/doctype/telephony_call_type/test_telephony_call_type.py @@ -3,8 +3,8 @@ # import frappe import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestTelephonyCallType(IntegrationTestCase): +class TestTelephonyCallType(ERPNextTestSuite): pass diff --git a/erpnext/telephony/doctype/voice_call_settings/test_voice_call_settings.py b/erpnext/telephony/doctype/voice_call_settings/test_voice_call_settings.py index c1c6d68d964..d660fb1a6fc 100644 --- a/erpnext/telephony/doctype/voice_call_settings/test_voice_call_settings.py +++ b/erpnext/telephony/doctype/voice_call_settings/test_voice_call_settings.py @@ -3,8 +3,8 @@ # import frappe import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestVoiceCallSettings(IntegrationTestCase): +class TestVoiceCallSettings(ERPNextTestSuite): pass diff --git a/erpnext/tests/test_activation.py b/erpnext/tests/test_activation.py index 8968017d2f0..7c338e105d1 100644 --- a/erpnext/tests/test_activation.py +++ b/erpnext/tests/test_activation.py @@ -1,9 +1,8 @@ -from frappe.tests import IntegrationTestCase - +from erpnext.tests.utils import ERPNextTestSuite from erpnext.utilities.activation import get_level -class TestActivation(IntegrationTestCase): +class TestActivation(ERPNextTestSuite): def test_activation(self): site_info = {"activation": {"activation_level": 0, "sales_data": []}} levels = get_level(site_info) diff --git a/erpnext/tests/test_init.py b/erpnext/tests/test_init.py index 70944f4114c..4be96199ddd 100644 --- a/erpnext/tests/test_init.py +++ b/erpnext/tests/test_init.py @@ -1,12 +1,8 @@ -import unittest - -import frappe -from frappe.tests import IntegrationTestCase - from erpnext import encode_company_abbr +from erpnext.tests.utils import ERPNextTestSuite -class TestInit(IntegrationTestCase): +class TestInit(ERPNextTestSuite): def test_encode_company_abbr(self): abbr = "NFECT" diff --git a/erpnext/tests/test_notifications.py b/erpnext/tests/test_notifications.py index 9c27229d335..1e0a48065dd 100644 --- a/erpnext/tests/test_notifications.py +++ b/erpnext/tests/test_notifications.py @@ -4,10 +4,11 @@ import unittest import frappe from frappe.desk import notifications -from frappe.tests import IntegrationTestCase + +from erpnext.tests.utils import ERPNextTestSuite -class TestNotifications(IntegrationTestCase): +class TestNotifications(ERPNextTestSuite): def test_get_notifications_for_targets(self): """ Test notification config entries for targets as percentages diff --git a/erpnext/tests/test_perf.py b/erpnext/tests/test_perf.py index 4967d981dda..cb4ecd2ee13 100644 --- a/erpnext/tests/test_perf.py +++ b/erpnext/tests/test_perf.py @@ -1,5 +1,6 @@ import frappe -from frappe.tests import IntegrationTestCase + +from erpnext.tests.utils import ERPNextTestSuite INDEXED_FIELDS = { "Bin": ["item_code"], @@ -8,7 +9,7 @@ INDEXED_FIELDS = { } -class TestPerformance(IntegrationTestCase): +class TestPerformance(ERPNextTestSuite): def test_ensure_indexes(self): # These fields are not explicitly indexed BUT they are prefix in some # other composite index. If those are removed this test should be diff --git a/erpnext/tests/test_point_of_sale.py b/erpnext/tests/test_point_of_sale.py index 589c7cb0e48..36fad7ad64f 100644 --- a/erpnext/tests/test_point_of_sale.py +++ b/erpnext/tests/test_point_of_sale.py @@ -2,16 +2,14 @@ # MIT License. See license.txt import unittest -import frappe -from frappe.tests import IntegrationTestCase - from erpnext.accounts.doctype.pos_profile.test_pos_profile import make_pos_profile from erpnext.selling.page.point_of_sale.point_of_sale import get_items 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.tests.utils import ERPNextTestSuite -class TestPointOfSale(IntegrationTestCase): +class TestPointOfSale(ERPNextTestSuite): def test_item_search(self): """ Test Stock and Service Item Search. diff --git a/erpnext/tests/test_regional.py b/erpnext/tests/test_regional.py index 83f551aae8e..648986bf648 100644 --- a/erpnext/tests/test_regional.py +++ b/erpnext/tests/test_regional.py @@ -1,9 +1,9 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase import erpnext +from erpnext.tests.utils import ERPNextTestSuite @erpnext.allow_regional @@ -11,7 +11,7 @@ def test_method(): return "original" -class TestInit(IntegrationTestCase): +class TestInit(ERPNextTestSuite): def test_regional_overrides(self): frappe.flags.country = "Maldives" self.assertEqual(test_method(), "original") diff --git a/erpnext/tests/test_webform.py b/erpnext/tests/test_webform.py index 5f600941e8f..8b4ed9ceec9 100644 --- a/erpnext/tests/test_webform.py +++ b/erpnext/tests/test_webform.py @@ -1,13 +1,13 @@ import unittest import frappe -from frappe.tests import IntegrationTestCase from erpnext.buying.doctype.purchase_order.test_purchase_order import create_purchase_order from erpnext.buying.doctype.supplier.test_supplier import create_supplier +from erpnext.tests.utils import ERPNextTestSuite -class TestWebsite(IntegrationTestCase): +class TestWebsite(ERPNextTestSuite): def test_permission_for_custom_doctype(self): create_user("Supplier 1", "supplier1@gmail.com") create_user("Supplier 2", "supplier2@gmail.com") diff --git a/erpnext/tests/test_zform_loads.py b/erpnext/tests/test_zform_loads.py index ef68c10273f..3d24b77c92a 100644 --- a/erpnext/tests/test_zform_loads.py +++ b/erpnext/tests/test_zform_loads.py @@ -2,12 +2,13 @@ import frappe from frappe.desk.form.load import getdoc -from frappe.tests import IntegrationTestCase from frappe.www.printview import get_html_and_style +from erpnext.tests.utils import ERPNextTestSuite -class TestFormLoads(IntegrationTestCase): - @IntegrationTestCase.change_settings("Print Settings", {"allow_print_for_cancelled": 1}) + +class TestFormLoads(ERPNextTestSuite): + @ERPNextTestSuite.change_settings("Print Settings", {"allow_print_for_cancelled": 1}) def test_load(self): erpnext_modules = frappe.get_all("Module Def", filters={"app_name": "erpnext"}, pluck="name") doctypes = frappe.get_all( diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py index a2a9ba57377..9d0f4ebc0e4 100644 --- a/erpnext/tests/utils.py +++ b/erpnext/tests/utils.py @@ -7,7 +7,6 @@ from typing import Any, NewType import frappe from frappe import _ from frappe.core.doctype.report.report import get_report_module_dotted_path -from frappe.tests import IntegrationTestCase from frappe.utils import now_datetime ReportFilters = dict[str, Any] diff --git a/erpnext/utilities/doctype/video/test_video.py b/erpnext/utilities/doctype/video/test_video.py index 4d37c575f84..55201932259 100644 --- a/erpnext/utilities/doctype/video/test_video.py +++ b/erpnext/utilities/doctype/video/test_video.py @@ -3,8 +3,8 @@ # import frappe import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestVideo(IntegrationTestCase): +class TestVideo(ERPNextTestSuite): pass diff --git a/erpnext/utilities/doctype/video_settings/test_video_settings.py b/erpnext/utilities/doctype/video_settings/test_video_settings.py index fea375e5128..2fb854128ff 100644 --- a/erpnext/utilities/doctype/video_settings/test_video_settings.py +++ b/erpnext/utilities/doctype/video_settings/test_video_settings.py @@ -3,8 +3,8 @@ # import frappe import unittest -from frappe.tests import IntegrationTestCase +from erpnext.tests.utils import ERPNextTestSuite -class TestVideoSettings(IntegrationTestCase): +class TestVideoSettings(ERPNextTestSuite): pass