test: add custom TestCase class and use in stock

This commit is contained in:
Ankush Menat
2021-09-14 20:05:16 +05:30
committed by Ankush Menat
parent c6a56a8f53
commit 06fa35a9c1
22 changed files with 67 additions and 52 deletions

View File

@@ -2,6 +2,7 @@
# License: GNU General Public License v3. See license.txt
import copy
import unittest
from contextlib import contextmanager
from typing import Any, Dict, NewType, Optional
@@ -12,6 +13,20 @@ ReportFilters = Dict[str, Any]
ReportName = NewType("ReportName", str)
class ERPNextTestCase(unittest.TestCase):
"""A sane default test class for ERPNext tests."""
def setUp(self) -> None:
frappe.db.commit()
return super().setUp()
def tearDown(self) -> None:
frappe.db.rollback()
return super().tearDown()
def create_test_contact_and_address():
frappe.db.sql('delete from tabContact')
frappe.db.sql('delete from `tabContact Email`')