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 <me@akhilnarang.dev>
This commit is contained in:
parent
0c3be512db
commit
770024f048
1 changed files with 4 additions and 2 deletions
|
|
@ -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")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue