From df4c27efddf355e2731a18e8871e54d18590f219 Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Wed, 13 Oct 2021 20:12:01 +0530 Subject: [PATCH] test: remove commits from accounts module tests --- erpnext/accounts/doctype/account/test_account.py | 5 ++--- .../accounting_dimension/test_accounting_dimension.py | 6 ++---- .../test_accounting_dimension_filter.py | 6 ++---- .../doctype/accounting_period/test_accounting_period.py | 6 ++---- .../doctype/accounts_settings/test_accounts_settings.py | 7 +++---- .../accounts/doctype/bank_account/test_bank_account.py | 7 +++---- .../doctype/bank_transaction/test_bank_transaction.py | 7 ++++--- erpnext/accounts/doctype/budget/test_budget.py | 6 ++---- .../doctype/cash_flow_mapping/test_cash_flow_mapping.py | 7 +++---- erpnext/accounts/doctype/cost_center/test_cost_center.py | 7 +++---- erpnext/accounts/doctype/coupon_code/test_coupon_code.py | 6 ++---- erpnext/accounts/doctype/dunning/test_dunning.py | 8 ++++---- .../accounts/doctype/finance_book/test_finance_book.py | 6 ++---- erpnext/accounts/doctype/fiscal_year/test_fiscal_year.py | 6 ++---- erpnext/accounts/doctype/gl_entry/test_gl_entry.py | 7 ++----- .../invoice_discounting/test_invoice_discounting.py | 6 ++---- .../accounts/doctype/journal_entry/test_journal_entry.py | 6 ++---- .../doctype/loyalty_program/test_loyalty_program.py | 7 +++---- .../test_opening_invoice_creation_tool.py | 6 ++---- .../accounts/doctype/payment_entry/test_payment_entry.py | 6 ++---- .../accounts/doctype/payment_order/test_payment_order.py | 6 ++---- .../doctype/payment_request/test_payment_request.py | 6 ++---- .../payment_terms_template/test_payment_terms_template.py | 7 +++---- .../period_closing_voucher/test_period_closing_voucher.py | 6 ++---- .../doctype/pos_closing_entry/test_pos_closing_entry.py | 6 ++---- erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py | 6 +++--- .../pos_invoice_merge_log/test_pos_invoice_merge_log.py | 5 ++--- erpnext/accounts/doctype/pos_profile/test_pos_profile.py | 6 ++---- .../accounts/doctype/pricing_rule/test_pricing_rule.py | 6 ++---- .../test_process_deferred_accounting.py | 6 ++---- .../doctype/promotional_scheme/test_promotional_scheme.py | 7 +++---- .../doctype/purchase_invoice/test_purchase_invoice.py | 8 ++++---- .../accounts/doctype/sales_invoice/test_sales_invoice.py | 7 ++++--- .../doctype/share_transfer/test_share_transfer.py | 6 ++---- erpnext/accounts/doctype/shareholder/test_shareholder.py | 1 - .../accounts/doctype/shipping_rule/test_shipping_rule.py | 6 ++---- .../accounts/doctype/subscription/test_subscription.py | 6 ++---- erpnext/accounts/doctype/tax_rule/test_tax_rule.py | 8 ++++---- .../test_tax_withholding_category.py | 7 +++---- .../report/account_balance/test_account_balance.py | 6 ++---- .../accounts_receivable/test_accounts_receivable.py | 6 ++---- .../sales_payment_summary/test_sales_payment_summary.py | 7 +++---- erpnext/accounts/report/tax_detail/test_tax_detail.py | 6 +++--- erpnext/accounts/test/test_utils.py | 6 ++---- 44 files changed, 107 insertions(+), 168 deletions(-) diff --git a/erpnext/accounts/doctype/account/test_account.py b/erpnext/accounts/doctype/account/test_account.py index 0c3b33e0b9e..e2bd7b7f4cc 100644 --- a/erpnext/accounts/doctype/account/test_account.py +++ b/erpnext/accounts/doctype/account/test_account.py @@ -1,17 +1,16 @@ # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: GNU General Public License v3. See license.txt -from __future__ import unicode_literals -import unittest import frappe from erpnext.accounts.doctype.account.account import merge_account, update_account_number from erpnext.stock import get_company_default_inventory_account, get_warehouse_account +from erpnext.tests.utils import ERPNextTestCase -class TestAccount(unittest.TestCase): +class TestAccount(ERPNextTestCase): 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/accounting_dimension/test_accounting_dimension.py b/erpnext/accounts/doctype/accounting_dimension/test_accounting_dimension.py index 3769fc12707..e3f20ed78c0 100644 --- a/erpnext/accounts/doctype/accounting_dimension/test_accounting_dimension.py +++ b/erpnext/accounts/doctype/accounting_dimension/test_accounting_dimension.py @@ -1,18 +1,16 @@ # -*- coding: utf-8 -*- # Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt -from __future__ import unicode_literals - -import unittest import frappe 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 ERPNextTestCase test_dependencies = ['Cost Center', 'Location', 'Warehouse', 'Department'] -class TestAccountingDimension(unittest.TestCase): +class TestAccountingDimension(ERPNextTestCase): 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 9968f689916..80ced6666bc 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 @@ -1,9 +1,6 @@ # -*- coding: utf-8 -*- # Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt -from __future__ import unicode_literals - -import unittest import frappe @@ -13,10 +10,11 @@ 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 ERPNextTestCase test_dependencies = ['Location', 'Cost Center', 'Department'] -class TestAccountingDimensionFilter(unittest.TestCase): +class TestAccountingDimensionFilter(ERPNextTestCase): 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 5885b58e481..a4bb6440394 100644 --- a/erpnext/accounts/doctype/accounting_period/test_accounting_period.py +++ b/erpnext/accounts/doctype/accounting_period/test_accounting_period.py @@ -1,9 +1,6 @@ # -*- coding: utf-8 -*- # Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt -from __future__ import unicode_literals - -import unittest import frappe from frappe.utils import add_months, nowdate @@ -11,10 +8,11 @@ from frappe.utils import add_months, nowdate 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.accounts.general_ledger import ClosedAccountingPeriod +from erpnext.tests.utils import ERPNextTestCase test_dependencies = ['Item'] -class TestAccountingPeriod(unittest.TestCase): +class TestAccountingPeriod(ERPNextTestCase): 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 c1c156fa65e..4dab3a08a98 100644 --- a/erpnext/accounts/doctype/accounts_settings/test_accounts_settings.py +++ b/erpnext/accounts/doctype/accounts_settings/test_accounts_settings.py @@ -1,11 +1,10 @@ -from __future__ import unicode_literals - -import unittest import frappe +from erpnext.tests.utils import ERPNextTestCase -class TestAccountsSettings(unittest.TestCase): + +class TestAccountsSettings(ERPNextTestCase): 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/bank_account/test_bank_account.py b/erpnext/accounts/doctype/bank_account/test_bank_account.py index dc970f3d99e..94007419503 100644 --- a/erpnext/accounts/doctype/bank_account/test_bank_account.py +++ b/erpnext/accounts/doctype/bank_account/test_bank_account.py @@ -1,16 +1,15 @@ # -*- coding: utf-8 -*- # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt -from __future__ import unicode_literals - -import unittest import frappe from frappe import ValidationError +from erpnext.tests.utils import ERPNextTestCase + # test_records = frappe.get_test_records('Bank Account') -class TestBankAccount(unittest.TestCase): +class TestBankAccount(ERPNextTestCase): def test_validate_iban(self): valid_ibans = [ diff --git a/erpnext/accounts/doctype/bank_transaction/test_bank_transaction.py b/erpnext/accounts/doctype/bank_transaction/test_bank_transaction.py index 35d08bd8033..14d8f37a31f 100644 --- a/erpnext/accounts/doctype/bank_transaction/test_bank_transaction.py +++ b/erpnext/accounts/doctype/bank_transaction/test_bank_transaction.py @@ -1,10 +1,8 @@ # -*- coding: utf-8 -*- # Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt -from __future__ import unicode_literals import json -import unittest import frappe @@ -16,12 +14,14 @@ 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 ERPNextTestCase test_dependencies = ["Item", "Cost Center"] -class TestBankTransaction(unittest.TestCase): +class TestBankTransaction(ERPNextTestCase): @classmethod def setUpClass(cls): + super().setUpClass() make_pos_profile() add_transactions() add_vouchers() @@ -40,6 +40,7 @@ class TestBankTransaction(unittest.TestCase): # Delete POS Profile frappe.db.sql("delete from `tabPOS Profile`") + super().tearDownClass() # This test checks if ERPNext is able to provide a linked payment for a bank transaction based on the amount of the bank transaction. def test_linked_payments(self): diff --git a/erpnext/accounts/doctype/budget/test_budget.py b/erpnext/accounts/doctype/budget/test_budget.py index cc8220920e3..e88e3b91c6f 100644 --- a/erpnext/accounts/doctype/budget/test_budget.py +++ b/erpnext/accounts/doctype/budget/test_budget.py @@ -1,9 +1,6 @@ # -*- coding: utf-8 -*- # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt -from __future__ import unicode_literals - -import unittest import frappe from frappe.utils import now_datetime, nowdate @@ -12,10 +9,11 @@ from erpnext.accounts.doctype.budget.budget import BudgetError, get_actual_expen from erpnext.accounts.doctype.journal_entry.test_journal_entry import make_journal_entry from erpnext.accounts.utils import get_fiscal_year from erpnext.buying.doctype.purchase_order.test_purchase_order import create_purchase_order +from erpnext.tests.utils import ERPNextTestCase test_dependencies = ['Monthly Distribution'] -class TestBudget(unittest.TestCase): +class TestBudget(ERPNextTestCase): def test_monthly_budget_crossed_ignore(self): set_total_expense_zero(nowdate(), "cost_center") diff --git a/erpnext/accounts/doctype/cash_flow_mapping/test_cash_flow_mapping.py b/erpnext/accounts/doctype/cash_flow_mapping/test_cash_flow_mapping.py index 5e44c61379b..53d7c692ba1 100644 --- a/erpnext/accounts/doctype/cash_flow_mapping/test_cash_flow_mapping.py +++ b/erpnext/accounts/doctype/cash_flow_mapping/test_cash_flow_mapping.py @@ -1,14 +1,13 @@ # -*- coding: utf-8 -*- # Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt -from __future__ import unicode_literals - -import unittest import frappe +from erpnext.tests.utils import ERPNextTestCase -class TestCashFlowMapping(unittest.TestCase): + +class TestCashFlowMapping(ERPNextTestCase): def setUp(self): if frappe.db.exists("Cash Flow Mapping", "Test Mapping"): frappe.delete_doc('Cash Flow Mappping', 'Test Mapping') diff --git a/erpnext/accounts/doctype/cost_center/test_cost_center.py b/erpnext/accounts/doctype/cost_center/test_cost_center.py index 142b925c2ea..e1848754e91 100644 --- a/erpnext/accounts/doctype/cost_center/test_cost_center.py +++ b/erpnext/accounts/doctype/cost_center/test_cost_center.py @@ -1,14 +1,13 @@ # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: GNU General Public License v3. See license.txt -from __future__ import unicode_literals - -import unittest import frappe +from erpnext.tests.utils import ERPNextTestCase + test_records = frappe.get_test_records('Cost Center') -class TestCostCenter(unittest.TestCase): +class TestCostCenter(ERPNextTestCase): def test_cost_center_creation_against_child_node(self): if not frappe.db.get_value('Cost Center', {'name': '_Test Cost Center 2 - _TC'}): diff --git a/erpnext/accounts/doctype/coupon_code/test_coupon_code.py b/erpnext/accounts/doctype/coupon_code/test_coupon_code.py index bf8c014a5b9..232d92dfef2 100644 --- a/erpnext/accounts/doctype/coupon_code/test_coupon_code.py +++ b/erpnext/accounts/doctype/coupon_code/test_coupon_code.py @@ -1,13 +1,11 @@ # -*- coding: utf-8 -*- # Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt -from __future__ import unicode_literals - -import unittest import frappe from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order +from erpnext.tests.utils import ERPNextTestCase test_dependencies = ['Item'] @@ -98,7 +96,7 @@ def test_create_test_data(): }) coupon_code.insert() -class TestCouponCode(unittest.TestCase): +class TestCouponCode(ERPNextTestCase): def setUp(self): test_create_test_data() diff --git a/erpnext/accounts/doctype/dunning/test_dunning.py b/erpnext/accounts/doctype/dunning/test_dunning.py index 9e8b6553360..35f170aa782 100644 --- a/erpnext/accounts/doctype/dunning/test_dunning.py +++ b/erpnext/accounts/doctype/dunning/test_dunning.py @@ -1,9 +1,6 @@ # -*- coding: utf-8 -*- # Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt -from __future__ import unicode_literals - -import unittest import frappe from frappe.utils import add_days, nowdate, today @@ -16,11 +13,13 @@ from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import ( from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import ( create_sales_invoice_against_cost_center, ) +from erpnext.tests.utils import ERPNextTestCase -class TestDunning(unittest.TestCase): +class TestDunning(ERPNextTestCase): @classmethod def setUpClass(self): + super().setUpClass() create_dunning_type() create_dunning_type_with_zero_interest_rate() unlink_payment_on_cancel_of_invoice() @@ -28,6 +27,7 @@ class TestDunning(unittest.TestCase): @classmethod def tearDownClass(self): unlink_payment_on_cancel_of_invoice(0) + super().tearDownClass() def test_dunning(self): dunning = create_dunning() diff --git a/erpnext/accounts/doctype/finance_book/test_finance_book.py b/erpnext/accounts/doctype/finance_book/test_finance_book.py index 87a8ae260c0..3e5340dbc04 100644 --- a/erpnext/accounts/doctype/finance_book/test_finance_book.py +++ b/erpnext/accounts/doctype/finance_book/test_finance_book.py @@ -1,16 +1,14 @@ # -*- coding: utf-8 -*- # Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt -from __future__ import unicode_literals - -import unittest import frappe from erpnext.accounts.doctype.journal_entry.test_journal_entry import make_journal_entry +from erpnext.tests.utils import ERPNextTestCase -class TestFinanceBook(unittest.TestCase): +class TestFinanceBook(ERPNextTestCase): 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 b0365afa827..5a2a0a4d27c 100644 --- a/erpnext/accounts/doctype/fiscal_year/test_fiscal_year.py +++ b/erpnext/accounts/doctype/fiscal_year/test_fiscal_year.py @@ -1,18 +1,16 @@ # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: GNU General Public License v3. See license.txt -from __future__ import unicode_literals - -import unittest import frappe from erpnext.accounts.doctype.fiscal_year.fiscal_year import FiscalYearIncorrectDate +from erpnext.tests.utils import ERPNextTestCase test_records = frappe.get_test_records('Fiscal Year') test_ignore = ["Company"] -class TestFiscalYear(unittest.TestCase): +class TestFiscalYear(ERPNextTestCase): def test_extra_year(self): if frappe.db.exists("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 14959520767..c443d74bfe9 100644 --- a/erpnext/accounts/doctype/gl_entry/test_gl_entry.py +++ b/erpnext/accounts/doctype/gl_entry/test_gl_entry.py @@ -1,18 +1,15 @@ # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: GNU General Public License v3. See license.txt -from __future__ import unicode_literals - -import unittest - import frappe from frappe.model.naming import parse_naming_series 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 ERPNextTestCase -class TestGLEntry(unittest.TestCase): +class TestGLEntry(ERPNextTestCase): 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 58aea92e817..f793193b67f 100644 --- a/erpnext/accounts/doctype/invoice_discounting/test_invoice_discounting.py +++ b/erpnext/accounts/doctype/invoice_discounting/test_invoice_discounting.py @@ -1,9 +1,6 @@ # -*- coding: utf-8 -*- # Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt -from __future__ import unicode_literals - -import unittest import frappe from frappe.utils import add_days, flt, nowdate @@ -12,9 +9,10 @@ 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 ERPNextTestCase -class TestInvoiceDiscounting(unittest.TestCase): +class TestInvoiceDiscounting(ERPNextTestCase): def setUp(self): self.ar_credit = create_account(account_name="_Test Accounts Receivable Credit", parent_account = "Accounts Receivable - _TC", company="_Test Company") self.ar_discounted = create_account(account_name="_Test Accounts Receivable Discounted", parent_account = "Accounts Receivable - _TC", company="_Test Company") diff --git a/erpnext/accounts/doctype/journal_entry/test_journal_entry.py b/erpnext/accounts/doctype/journal_entry/test_journal_entry.py index d03a08851a6..967a519c497 100644 --- a/erpnext/accounts/doctype/journal_entry/test_journal_entry.py +++ b/erpnext/accounts/doctype/journal_entry/test_journal_entry.py @@ -1,9 +1,6 @@ # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: GNU General Public License v3. See license.txt -from __future__ import unicode_literals - -import unittest import frappe from frappe.utils import flt, nowdate @@ -11,9 +8,10 @@ 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.tests.utils import ERPNextTestCase -class TestJournalEntry(unittest.TestCase): +class TestJournalEntry(ERPNextTestCase): def test_journal_entry_with_against_jv(self): jv_invoice = frappe.copy_doc(test_records[2]) base_jv = frappe.copy_doc(test_records[0]) diff --git a/erpnext/accounts/doctype/loyalty_program/test_loyalty_program.py b/erpnext/accounts/doctype/loyalty_program/test_loyalty_program.py index a039e32b8b9..71db4686114 100644 --- a/erpnext/accounts/doctype/loyalty_program/test_loyalty_program.py +++ b/erpnext/accounts/doctype/loyalty_program/test_loyalty_program.py @@ -1,9 +1,6 @@ # -*- coding: utf-8 -*- # Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt -from __future__ import unicode_literals - -import unittest import frappe from frappe.utils import cint, flt, getdate, today @@ -12,11 +9,13 @@ 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 ERPNextTestCase -class TestLoyaltyProgram(unittest.TestCase): +class TestLoyaltyProgram(ERPNextTestCase): @classmethod def setUpClass(self): + super().setUpClass() # create relevant item, customer, loyalty program, etc create_records() 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 ed3c6a9da0a..ce89f632248 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 @@ -1,9 +1,6 @@ # -*- coding: utf-8 -*- # Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt -from __future__ import unicode_literals - -import unittest import frappe from frappe.cache_manager import clear_doctype_cache @@ -12,10 +9,11 @@ from frappe.custom.doctype.property_setter.property_setter import make_property_ from erpnext.accounts.doctype.opening_invoice_creation_tool.opening_invoice_creation_tool import ( get_temporary_opening_account, ) +from erpnext.tests.utils import ERPNextTestCase test_dependencies = ["Customer", "Supplier"] -class TestOpeningInvoiceCreationTool(unittest.TestCase): +class TestOpeningInvoiceCreationTool(ERPNextTestCase): def setUp(self): if not frappe.db.exists("Company", "_Test Opening Invoice Company"): make_company() diff --git a/erpnext/accounts/doctype/payment_entry/test_payment_entry.py b/erpnext/accounts/doctype/payment_entry/test_payment_entry.py index c90a3c503c2..562897657a6 100644 --- a/erpnext/accounts/doctype/payment_entry/test_payment_entry.py +++ b/erpnext/accounts/doctype/payment_entry/test_payment_entry.py @@ -1,9 +1,6 @@ # -*- coding: utf-8 -*- # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt -from __future__ import unicode_literals - -import unittest import frappe from frappe.utils import flt, nowdate @@ -22,11 +19,12 @@ from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import ( ) from erpnext.hr.doctype.expense_claim.test_expense_claim import make_expense_claim from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order +from erpnext.tests.utils import ERPNextTestCase test_dependencies = ["Item"] -class TestPaymentEntry(unittest.TestCase): +class TestPaymentEntry(ERPNextTestCase): def test_payment_entry_against_order(self): so = make_sales_order() pe = get_payment_entry("Sales Order", so.name, bank_account="_Test Cash - _TC") diff --git a/erpnext/accounts/doctype/payment_order/test_payment_order.py b/erpnext/accounts/doctype/payment_order/test_payment_order.py index 6414473346b..e9731ade126 100644 --- a/erpnext/accounts/doctype/payment_order/test_payment_order.py +++ b/erpnext/accounts/doctype/payment_order/test_payment_order.py @@ -1,9 +1,6 @@ # -*- coding: utf-8 -*- # Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt -from __future__ import unicode_literals - -import unittest import frappe from frappe.utils import getdate @@ -14,9 +11,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 ERPNextTestCase -class TestPaymentOrder(unittest.TestCase): +class TestPaymentOrder(ERPNextTestCase): def setUp(self): create_bank_account() diff --git a/erpnext/accounts/doctype/payment_request/test_payment_request.py b/erpnext/accounts/doctype/payment_request/test_payment_request.py index c97c873fc4e..9e82721959f 100644 --- a/erpnext/accounts/doctype/payment_request/test_payment_request.py +++ b/erpnext/accounts/doctype/payment_request/test_payment_request.py @@ -1,9 +1,6 @@ # -*- coding: utf-8 -*- # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt -from __future__ import unicode_literals - -import unittest import frappe @@ -11,6 +8,7 @@ from erpnext.accounts.doctype.payment_request.payment_request import make_paymen 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.setup.utils import get_exchange_rate +from erpnext.tests.utils import ERPNextTestCase test_dependencies = ["Currency Exchange", "Journal Entry", "Contact", "Address"] @@ -35,7 +33,7 @@ payment_method = [ } ] -class TestPaymentRequest(unittest.TestCase): +class TestPaymentRequest(ERPNextTestCase): def setUp(self): if not frappe.db.get_value("Payment Gateway", payment_gateway["gateway"], "name"): frappe.get_doc(payment_gateway).insert(ignore_permissions=True) 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 2052a5093d2..914df900eb7 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 @@ -1,14 +1,13 @@ # -*- coding: utf-8 -*- # Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt -from __future__ import unicode_literals - -import unittest import frappe +from erpnext.tests.utils import ERPNextTestCase -class TestPaymentTermsTemplate(unittest.TestCase): + +class TestPaymentTermsTemplate(ERPNextTestCase): 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 2d417a4cfba..62f8dbf7472 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 @@ -2,9 +2,6 @@ # License: GNU General Public License v3. See license.txt -from __future__ import unicode_literals - -import unittest import frappe from frappe.utils import today @@ -13,9 +10,10 @@ from erpnext.accounts.doctype.finance_book.test_finance_book import create_finan 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, now +from erpnext.tests.utils import ERPNextTestCase -class TestPeriodClosingVoucher(unittest.TestCase): +class TestPeriodClosingVoucher(ERPNextTestCase): def test_closing_entry(self): frappe.db.sql("delete from `tabGL Entry` where company='Test PCV Company'") 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 44c87d6e41b..c0eb0b7b04a 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 @@ -1,9 +1,6 @@ # -*- coding: utf-8 -*- # Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt -from __future__ import unicode_literals - -import unittest import frappe @@ -14,9 +11,10 @@ from erpnext.accounts.doctype.pos_invoice.test_pos_invoice import create_pos_inv from erpnext.accounts.doctype.pos_opening_entry.test_pos_opening_entry import create_opening_entry 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 ERPNextTestCase -class TestPOSClosingEntry(unittest.TestCase): +class TestPOSClosingEntry(ERPNextTestCase): def setUp(self): # Make stock available for POS Sales make_stock_entry(target="_Test Warehouse - _TC", qty=2, basic_rate=100) diff --git a/erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py b/erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py index e6e0dd238f0..954d9b5313c 100644 --- a/erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py +++ b/erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py @@ -1,10 +1,8 @@ # -*- coding: utf-8 -*- # Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt -from __future__ import unicode_literals import copy -import unittest import frappe @@ -14,11 +12,13 @@ from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sal 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 ERPNextTestCase -class TestPOSInvoice(unittest.TestCase): +class TestPOSInvoice(ERPNextTestCase): @classmethod def setUpClass(cls): + super().setUpClass() make_stock_entry(target="_Test Warehouse - _TC", item_code="_Test Item", qty=800, basic_rate=100) frappe.db.sql("delete from `tabTax Rule`") diff --git a/erpnext/accounts/doctype/pos_invoice_merge_log/test_pos_invoice_merge_log.py b/erpnext/accounts/doctype/pos_invoice_merge_log/test_pos_invoice_merge_log.py index c531bb9f079..816a88432fe 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 @@ -1,10 +1,8 @@ # -*- coding: utf-8 -*- # Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt -from __future__ import unicode_literals import json -import unittest import frappe @@ -14,9 +12,10 @@ from erpnext.accounts.doctype.pos_invoice.test_pos_invoice import create_pos_inv from erpnext.accounts.doctype.pos_invoice_merge_log.pos_invoice_merge_log import ( consolidate_pos_invoices, ) +from erpnext.tests.utils import ERPNextTestCase -class TestPOSInvoiceMergeLog(unittest.TestCase): +class TestPOSInvoiceMergeLog(ERPNextTestCase): def test_consolidated_invoice_creation(self): frappe.db.sql("delete from `tabPOS Invoice`") diff --git a/erpnext/accounts/doctype/pos_profile/test_pos_profile.py b/erpnext/accounts/doctype/pos_profile/test_pos_profile.py index 7c53f4a0b07..23e0488382b 100644 --- a/erpnext/accounts/doctype/pos_profile/test_pos_profile.py +++ b/erpnext/accounts/doctype/pos_profile/test_pos_profile.py @@ -1,18 +1,16 @@ # -*- coding: utf-8 -*- # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors and Contributors # See license.txt -from __future__ import unicode_literals - -import unittest import frappe 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 ERPNextTestCase test_dependencies = ['Item'] -class TestPOSProfile(unittest.TestCase): +class TestPOSProfile(ERPNextTestCase): def test_pos_profile(self): make_pos_profile() diff --git a/erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py b/erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py index 23ce4e4620b..1f1a943ef5a 100644 --- a/erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py +++ b/erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py @@ -2,9 +2,6 @@ # License: GNU General Public License v3. See license.txt -from __future__ import unicode_literals - -import unittest import frappe @@ -12,9 +9,10 @@ from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sal 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 ERPNextTestCase -class TestPricingRule(unittest.TestCase): +class TestPricingRule(ERPNextTestCase): 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 69e2caa8e82..f8a203c3406 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 @@ -1,9 +1,6 @@ # -*- coding: utf-8 -*- # Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt -from __future__ import unicode_literals - -import unittest import frappe @@ -13,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 ERPNextTestCase -class TestProcessDeferredAccounting(unittest.TestCase): +class TestProcessDeferredAccounting(ERPNextTestCase): def test_creation_of_ledger_entry_on_submit(self): ''' test creation of gl entries on submission of document ''' deferred_account = create_account(account_name="Deferred Revenue", diff --git a/erpnext/accounts/doctype/promotional_scheme/test_promotional_scheme.py b/erpnext/accounts/doctype/promotional_scheme/test_promotional_scheme.py index 190b734cc17..030b7e4d16d 100644 --- a/erpnext/accounts/doctype/promotional_scheme/test_promotional_scheme.py +++ b/erpnext/accounts/doctype/promotional_scheme/test_promotional_scheme.py @@ -1,14 +1,13 @@ # -*- coding: utf-8 -*- # Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt -from __future__ import unicode_literals - -import unittest import frappe +from erpnext.tests.utils import ERPNextTestCase -class TestPromotionalScheme(unittest.TestCase): + +class TestPromotionalScheme(ERPNextTestCase): def test_promotional_scheme(self): ps = make_promotional_scheme() price_rules = frappe.get_all('Pricing Rule', fields = ["promotional_scheme_id", "name", "creation"], diff --git a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py index 5cbeb562326..5d83161928b 100644 --- a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py @@ -2,9 +2,6 @@ # License: GNU General Public License v3. See license.txt -from __future__ import unicode_literals - -import unittest import frappe from frappe.utils import add_days, cint, flt, getdate, nowdate, today @@ -22,19 +19,22 @@ from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import ( make_purchase_receipt, ) from erpnext.stock.doctype.stock_entry.test_stock_entry import get_qty_after_transaction +from erpnext.tests.utils import ERPNextTestCase test_dependencies = ["Item", "Cost Center", "Payment Term", "Payment Terms Template"] test_ignore = ["Serial No"] -class TestPurchaseInvoice(unittest.TestCase): +class TestPurchaseInvoice(ERPNextTestCase): @classmethod def setUpClass(self): + super().setUpClass() unlink_payment_on_cancel_of_invoice() frappe.db.set_value("Buying Settings", None, "allow_multiple_items", 1) @classmethod def tearDownClass(self): unlink_payment_on_cancel_of_invoice(0) + super().tearDownClass() def test_gl_entries_without_perpetual_inventory(self): frappe.db.set_value("Company", "_Test Company", "round_off_account", "Round Off - _TC") diff --git a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py index 56de3c62920..284cad4a819 100644 --- a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py @@ -1,9 +1,7 @@ # Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors # License: GNU General Public License v3. See license.txt -from __future__ import unicode_literals import copy -import unittest import frappe from frappe.model.dynamic_links import get_dynamic_link_map @@ -34,9 +32,10 @@ from erpnext.stock.doctype.stock_entry.test_stock_entry import ( make_stock_entry, ) from erpnext.stock.utils import get_incoming_rate +from erpnext.tests.utils import ERPNextTestCase -class TestSalesInvoice(unittest.TestCase): +class TestSalesInvoice(ERPNextTestCase): def make(self): w = frappe.copy_doc(test_records[0]) w.is_pos = 0 @@ -46,11 +45,13 @@ class TestSalesInvoice(unittest.TestCase): @classmethod def setUpClass(self): + super().setUpClass() unlink_payment_on_cancel_of_invoice() @classmethod def tearDownClass(self): unlink_payment_on_cancel_of_invoice(0) + super().tearDownClass() def test_timestamp_change(self): w = frappe.copy_doc(test_records[0]) diff --git a/erpnext/accounts/doctype/share_transfer/test_share_transfer.py b/erpnext/accounts/doctype/share_transfer/test_share_transfer.py index b40e5fbbf8e..52316cf394a 100644 --- a/erpnext/accounts/doctype/share_transfer/test_share_transfer.py +++ b/erpnext/accounts/doctype/share_transfer/test_share_transfer.py @@ -1,17 +1,15 @@ # -*- coding: utf-8 -*- # Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt -from __future__ import unicode_literals - -import unittest import frappe from erpnext.accounts.doctype.share_transfer.share_transfer import ShareDontExists +from erpnext.tests.utils import ERPNextTestCase test_dependencies = ["Share Type", "Shareholder"] -class TestShareTransfer(unittest.TestCase): +class TestShareTransfer(ERPNextTestCase): def setUp(self): frappe.db.sql("delete from `tabShare Transfer`") frappe.db.sql("delete from `tabShare Balance`") diff --git a/erpnext/accounts/doctype/shareholder/test_shareholder.py b/erpnext/accounts/doctype/shareholder/test_shareholder.py index 6790fdd2ff7..6557b30e294 100644 --- a/erpnext/accounts/doctype/shareholder/test_shareholder.py +++ b/erpnext/accounts/doctype/shareholder/test_shareholder.py @@ -1,7 +1,6 @@ # -*- coding: utf-8 -*- # Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt -from __future__ import unicode_literals import unittest diff --git a/erpnext/accounts/doctype/shipping_rule/test_shipping_rule.py b/erpnext/accounts/doctype/shipping_rule/test_shipping_rule.py index bdd9be3beda..1ec2cc23d42 100644 --- a/erpnext/accounts/doctype/shipping_rule/test_shipping_rule.py +++ b/erpnext/accounts/doctype/shipping_rule/test_shipping_rule.py @@ -1,8 +1,5 @@ # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: GNU General Public License v3. See license.txt -from __future__ import unicode_literals - -import unittest import frappe @@ -11,10 +8,11 @@ from erpnext.accounts.doctype.shipping_rule.shipping_rule import ( ManyBlankToValuesError, OverlappingConditionError, ) +from erpnext.tests.utils import ERPNextTestCase test_records = frappe.get_test_records('Shipping Rule') -class TestShippingRule(unittest.TestCase): +class TestShippingRule(ERPNextTestCase): def test_from_greater_than_to(self): shipping_rule = frappe.copy_doc(test_records[0]) shipping_rule.name = test_records[0].get('name') diff --git a/erpnext/accounts/doctype/subscription/test_subscription.py b/erpnext/accounts/doctype/subscription/test_subscription.py index 0f7a0a86a4d..f6634589ceb 100644 --- a/erpnext/accounts/doctype/subscription/test_subscription.py +++ b/erpnext/accounts/doctype/subscription/test_subscription.py @@ -1,9 +1,6 @@ # -*- coding: utf-8 -*- # Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt -from __future__ import unicode_literals - -import unittest import frappe from frappe.utils.data import ( @@ -17,6 +14,7 @@ from frappe.utils.data import ( ) from erpnext.accounts.doctype.subscription.subscription import get_prorata_factor +from erpnext.tests.utils import ERPNextTestCase test_dependencies = ("UOM", "Item Group", "Item") @@ -68,7 +66,7 @@ def create_plan(): supplier.supplier_group = 'All Supplier Groups' supplier.insert() -class TestSubscription(unittest.TestCase): +class TestSubscription(ERPNextTestCase): def setUp(self): create_plan() diff --git a/erpnext/accounts/doctype/tax_rule/test_tax_rule.py b/erpnext/accounts/doctype/tax_rule/test_tax_rule.py index f937274edf5..b78c53dfd09 100644 --- a/erpnext/accounts/doctype/tax_rule/test_tax_rule.py +++ b/erpnext/accounts/doctype/tax_rule/test_tax_rule.py @@ -1,29 +1,29 @@ # -*- coding: utf-8 -*- # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt -from __future__ import unicode_literals - -import unittest import frappe 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 ERPNextTestCase test_records = frappe.get_test_records('Tax Rule') from six import iteritems -class TestTaxRule(unittest.TestCase): +class TestTaxRule(ERPNextTestCase): @classmethod def setUpClass(cls): + super().setUpClass() frappe.db.set_value("Shopping Cart Settings", None, "enabled", 0) @classmethod def tearDownClass(cls): frappe.db.sql("delete from `tabTax Rule`") + super().tearDownClass() def setUp(self): frappe.db.sql("delete from `tabTax Rule`") 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 84b364b3427..c804124039c 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 @@ -1,21 +1,20 @@ # -*- coding: utf-8 -*- # Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt -from __future__ import unicode_literals - -import unittest import frappe from frappe.utils import today from erpnext.accounts.utils import get_fiscal_year +from erpnext.tests.utils import ERPNextTestCase test_dependencies = ["Supplier Group", "Customer Group"] -class TestTaxWithholdingCategory(unittest.TestCase): +class TestTaxWithholdingCategory(ERPNextTestCase): @classmethod def setUpClass(self): # create relevant supplier, etc + super().setUpClass() create_records() create_tax_with_holding_category() diff --git a/erpnext/accounts/report/account_balance/test_account_balance.py b/erpnext/accounts/report/account_balance/test_account_balance.py index 94c73f5264b..deedc6ced22 100644 --- a/erpnext/accounts/report/account_balance/test_account_balance.py +++ b/erpnext/accounts/report/account_balance/test_account_balance.py @@ -1,15 +1,13 @@ -from __future__ import unicode_literals - -import unittest import frappe 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 ERPNextTestCase -class TestAccountBalance(unittest.TestCase): +class TestAccountBalance(ERPNextTestCase): 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_receivable/test_accounts_receivable.py b/erpnext/accounts/report/accounts_receivable/test_accounts_receivable.py index 1d24561bb3f..68fd0aae4cd 100644 --- a/erpnext/accounts/report/accounts_receivable/test_accounts_receivable.py +++ b/erpnext/accounts/report/accounts_receivable/test_accounts_receivable.py @@ -1,6 +1,3 @@ -from __future__ import unicode_literals - -import unittest import frappe from frappe.utils import add_days, getdate, today @@ -8,9 +5,10 @@ from frappe.utils import add_days, getdate, 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.accounts_receivable import execute +from erpnext.tests.utils import ERPNextTestCase -class TestAccountsReceivable(unittest.TestCase): +class TestAccountsReceivable(ERPNextTestCase): def test_accounts_receivable(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/sales_payment_summary/test_sales_payment_summary.py b/erpnext/accounts/report/sales_payment_summary/test_sales_payment_summary.py index 9fd7bc3de73..8eb47aef6d7 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 @@ -1,9 +1,6 @@ # Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors # License: GNU General Public License v3. See license.txt -from __future__ import unicode_literals - -import unittest import frappe from frappe.utils import today @@ -13,12 +10,14 @@ 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 ERPNextTestCase test_dependencies = ["Sales Invoice"] -class TestSalesPaymentSummary(unittest.TestCase): +class TestSalesPaymentSummary(ERPNextTestCase): @classmethod def setUpClass(self): + super().setUpClass() create_records() pes = frappe.get_all("Payment Entry") jes = frappe.get_all("Journal Entry") diff --git a/erpnext/accounts/report/tax_detail/test_tax_detail.py b/erpnext/accounts/report/tax_detail/test_tax_detail.py index e74b905db17..8bc7c6ac0f1 100644 --- a/erpnext/accounts/report/tax_detail/test_tax_detail.py +++ b/erpnext/accounts/report/tax_detail/test_tax_detail.py @@ -1,9 +1,7 @@ -from __future__ import unicode_literals import datetime import json import os -import unittest import frappe from frappe.utils import ( @@ -15,10 +13,12 @@ from frappe.utils import ( getdate, ) +from erpnext.tests.utils import ERPNextTestCase + from .tax_detail import filter_match, save_custom_report -class TestTaxDetail(unittest.TestCase): +class TestTaxDetail(ERPNextTestCase): def load_testdocs(self): from erpnext.accounts.utils import FiscalYearError, get_fiscal_year datapath, _ = os.path.splitext(os.path.realpath(__file__)) diff --git a/erpnext/accounts/test/test_utils.py b/erpnext/accounts/test/test_utils.py index c3f6d274437..65e03d4616a 100644 --- a/erpnext/accounts/test/test_utils.py +++ b/erpnext/accounts/test/test_utils.py @@ -1,15 +1,13 @@ -from __future__ import unicode_literals - -import unittest from frappe.test_runner import make_test_objects from erpnext.accounts.party import get_party_shipping_address from erpnext.accounts.utils import get_future_stock_vouchers, get_voucherwise_gl_entries from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import make_purchase_receipt +from erpnext.tests.utils import ERPNextTestCase -class TestUtils(unittest.TestCase): +class TestUtils(ERPNextTestCase): @classmethod def setUpClass(cls): super(TestUtils, cls).setUpClass()