Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e9fbe9f

Browse files
committed
Work around leak of catch_warnings in PyPy.
https://foss.heptapod.net/pypy/pypy/-/issues/3536
1 parent 755cc76 commit e9fbe9f

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

lib/matplotlib/tests/test_animation.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import os
22
from pathlib import Path
3+
import platform
34
import subprocess
45
import sys
56
import weakref
@@ -86,6 +87,11 @@ def test_null_movie_writer(anim):
8687

8788
@pytest.mark.parametrize('anim', [dict(klass=dict)], indirect=['anim'])
8889
def test_animation_delete(anim):
90+
if platform.python_implementation() == 'PyPy':
91+
# Something in the test setup fixture lingers around into the test and
92+
# breaks pytest.warns on PyPy. This garbage collection fixes it.
93+
# https://foss.heptapod.net/pypy/pypy/-/issues/3536
94+
np.testing.break_cycles()
8995
anim = animation.FuncAnimation(**anim)
9096
with pytest.warns(Warning, match='Animation was deleted'):
9197
del anim
@@ -200,6 +206,11 @@ def test_save_animation_smoketest(tmpdir, writer, frame_format, output, anim):
200206
])
201207
@pytest.mark.parametrize('anim', [dict(klass=dict)], indirect=['anim'])
202208
def test_animation_repr_html(writer, html, want, anim):
209+
if platform.python_implementation() == 'PyPy':
210+
# Something in the test setup fixture lingers around into the test and
211+
# breaks pytest.warns on PyPy. This garbage collection fixes it.
212+
# https://foss.heptapod.net/pypy/pypy/-/issues/3536
213+
np.testing.break_cycles()
203214
if (writer == 'imagemagick' and html == 'html5'
204215
# ImageMagick delegates to ffmpeg for this format.
205216
and not animation.FFMpegWriter.isAvailable()):

0 commit comments

Comments
 (0)