Skip to content

Commit 828ec6f

Browse files
authored
Merge pull request #29970 from QuLogic/test-quiver-refcount
TST: Make refcount tests more resilient to Python changes
2 parents 4af11e7 + b2d746b commit 828ec6f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/matplotlib/tests/test_quiver.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,12 @@ def test_quiver_memory_leak():
2626

2727
Q = draw_quiver(ax)
2828
ttX = Q.X
29+
orig_refcount = sys.getrefcount(ttX)
2930
Q.remove()
3031

3132
del Q
3233

33-
assert sys.getrefcount(ttX) == 2
34+
assert sys.getrefcount(ttX) < orig_refcount
3435

3536

3637
@pytest.mark.skipif(platform.python_implementation() != 'CPython',
@@ -43,9 +44,9 @@ def test_quiver_key_memory_leak():
4344
qk = ax.quiverkey(Q, 0.5, 0.92, 2, r'$2 \frac{m}{s}$',
4445
labelpos='W',
4546
fontproperties={'weight': 'bold'})
46-
assert sys.getrefcount(qk) == 3
47+
orig_refcount = sys.getrefcount(qk)
4748
qk.remove()
48-
assert sys.getrefcount(qk) == 2
49+
assert sys.getrefcount(qk) < orig_refcount
4950

5051

5152
def test_quiver_number_of_args():

0 commit comments

Comments
 (0)
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