2
0
mirror of https://github.com/frappe/frappe.git synced 2024-06-13 05:42:26 +00:00

fix(test records): rollback only the test record that exists (#26415)

This commit is contained in:
Smit Vora 2024-05-13 13:34:23 +05:30 committed by GitHub
parent da740081c6
commit 4522d10afb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -446,6 +446,9 @@ def make_test_objects(doctype, test_records=None, verbose=None, reset=False, com
test_records = frappe.get_test_records(doctype)
for doc in test_records:
if not reset:
frappe.db.savepoint("creating_test_record")
if not doc.get("doctype"):
doc["doctype"] = doctype
@ -461,7 +464,7 @@ def make_test_objects(doctype, test_records=None, verbose=None, reset=False, com
d.set_new_name()
if frappe.db.exists(d.doctype, d.name) and not reset:
frappe.db.rollback()
frappe.db.rollback(save_point="creating_test_record")
# do not create test records, if already exists
continue