Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 0753e77

Browse filesBrowse files
tacaswellmeeseeksmachine
authored andcommitted
Backport PR #29970: TST: Make refcount tests more resilient to Python changes
1 parent 8a1cea5 commit 0753e77
Copy full SHA for 0753e77

File tree

1 file changed

+4
-3
lines changed
Filter options

1 file changed

+4
-3
lines changed

‎lib/matplotlib/tests/test_quiver.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_quiver.py
+4-3Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.