Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
May 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion frappe/test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,9 @@ def revert_naming(d):
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

Expand All @@ -461,7 +464,7 @@ def revert_naming(d):
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

Expand Down