From 4c29d5630d1bbd37ebcb673626164cf9fd4d9554 Mon Sep 17 00:00:00 2001 From: barredterra <14891507+barredterra@users.noreply.github.com> Date: Wed, 17 Jun 2026 17:34:42 +0200 Subject: [PATCH] test(stock): add cleanup for item attribute value changes in tests (cherry picked from commit 60f5de7ab80926afb710d7350185ce52e90a883c) --- erpnext/stock/doctype/item/test_item.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/erpnext/stock/doctype/item/test_item.py b/erpnext/stock/doctype/item/test_item.py index f7f4a444ea2..b4e18373cce 100644 --- a/erpnext/stock/doctype/item/test_item.py +++ b/erpnext/stock/doctype/item/test_item.py @@ -423,6 +423,17 @@ class TestItem(ERPNextTestSuite): row.attribute_value = "Larger" break + def restore_test_size_large(): + doc = frappe.get_doc("Item Attribute", "Test Size") + for row in doc.item_attribute_values: + if row.attribute_value == "Larger": + row.attribute_value = "Large" + break + frappe.flags.attribute_values = None + doc.save() + + self.addCleanup(restore_test_size_large) + frappe.flags.attribute_values = None attribute.save()