refactor: rollback after full test

This commit is contained in:
Ankush Menat 2021-10-12 14:45:29 +05:30 committed by Ankush Menat
parent 06fa35a9c1
commit acdb26a4bb
2 changed files with 8 additions and 6 deletions

View File

@ -26,6 +26,7 @@ from erpnext.tests.utils import ERPNextTestCase, change_settings
class TestStockReconciliation(ERPNextTestCase):
@classmethod
def setUpClass(self):
super().setUpClass()
create_batch_or_serial_no_items()
frappe.db.set_value("Stock Settings", None, "allow_negative_stock", 1)

View File

@ -16,15 +16,16 @@ ReportName = NewType("ReportName", str)
class ERPNextTestCase(unittest.TestCase):
"""A sane default test class for ERPNext tests."""
def setUp(self) -> None:
@classmethod
def setUpClass(cls) -> None:
frappe.db.commit()
return super().setUp()
return super().setUpClass()
def tearDown(self) -> None:
@classmethod
def tearDownClass(cls) -> None:
frappe.db.rollback()
return super().tearDown()
return super().tearDownClass()
def create_test_contact_and_address():