From 770024f048951a8e5fc302cdc2602debba09eae8 Mon Sep 17 00:00:00 2001 From: Akhil Narang Date: Wed, 8 Oct 2025 18:30:46 +0530 Subject: [PATCH] fix: adjust refcount test for python3.14 References: - https://docs.python.org/3.14/whatsnew/3.14.html#optimizations - https://docs.python.org/3.14/whatsnew/3.14.html#whatsnew314-refcount Signed-off-by: Akhil Narang --- frappe/tests/test_perf.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/frappe/tests/test_perf.py b/frappe/tests/test_perf.py index 241ed853c6..1e42c0f095 100644 --- a/frappe/tests/test_perf.py +++ b/frappe/tests/test_perf.py @@ -193,14 +193,16 @@ class TestPerformance(IntegrationTestCase): """ query = "select * from tabUser" + expected_refcount = 1 if sys.version_info >= (3, 14) else 2 for kwargs in ({}, {"as_dict": True}, {"as_list": True}): result = frappe.db.sql(query, **kwargs) - self.assertEqual(sys.getrefcount(result), 2) # Note: This always returns +1 + self.assertEqual(sys.getrefcount(result), expected_refcount) # Note: This always returns +1 self.assertFalse(gc.get_referrers(result)) def test_no_cyclic_references(self): doc = frappe.get_doc("User", "Administrator") - self.assertEqual(sys.getrefcount(doc), 2) # Note: This always returns +1 + expected_refcount = 1 if sys.version_info >= (3, 14) else 2 + self.assertEqual(sys.getrefcount(doc), expected_refcount) # Note: This always returns +1 def test_get_doc_cache_calls(self): frappe.get_doc("User", "Administrator")