test: add custom TestCase class and use in stock
diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py
index a3cab4b..95e5668 100644
--- a/erpnext/tests/utils.py
+++ b/erpnext/tests/utils.py
@@ -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 @@
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`')