From 0753e7731d3d75542af6214294dfb5cdab87ccd3 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Sun, 27 Apr 2025 21:29:39 -0400 Subject: [PATCH] Backport PR #29970: TST: Make refcount tests more resilient to Python changes --- lib/matplotlib/tests/test_quiver.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/matplotlib/tests/test_quiver.py b/lib/matplotlib/tests/test_quiver.py index e28b04025b5e..9cbe1639dadc 100644 --- a/lib/matplotlib/tests/test_quiver.py +++ b/lib/matplotlib/tests/test_quiver.py @@ -26,11 +26,12 @@ def test_quiver_memory_leak(): Q = draw_quiver(ax) ttX = Q.X + orig_refcount = sys.getrefcount(ttX) Q.remove() del Q - assert sys.getrefcount(ttX) == 2 + assert sys.getrefcount(ttX) < orig_refcount @pytest.mark.skipif(platform.python_implementation() != 'CPython', @@ -43,9 +44,9 @@ def test_quiver_key_memory_leak(): qk = ax.quiverkey(Q, 0.5, 0.92, 2, r'$2 \frac{m}{s}$', labelpos='W', fontproperties={'weight': 'bold'}) - assert sys.getrefcount(qk) == 3 + orig_refcount = sys.getrefcount(qk) qk.remove() - assert sys.getrefcount(qk) == 2 + assert sys.getrefcount(qk) < orig_refcount def test_quiver_number_of_args(): pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy