8000 TST: Check all supported animation frame formats. · matplotlib/matplotlib@6e3864a · GitHub
[go: up one dir, main page]

Skip to content

Commit 6e3864a

Browse files
committed
TST: Check all supported animation frame formats.
1 parent 8922733 commit 6e3864a

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

lib/matplotlib/tests/test_animation.py

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -141,19 +141,31 @@ def isAvailable(cls):
141141
('html', 'movie.html'),
142142
('null', 'movie.null')
143143
]
144-
WRITER_OUTPUT += [
145-
(writer, Path(output)) for writer, output in WRITER_OUTPUT]
144+
145+
146+
def gen_writers():
147+
for writer, output in WRITER_OUTPUT:
148+
if not animation.writers.is_available(writer):
149+
mark = pytest.mark.skip(
150+
f"writer '{writer}' not available on this system")
151+
yield pytest.param(writer, None, output, marks=[mark])
152+
yield pytest.param(writer, None, Path(output), marks=[mark])
153+
continue
154+
155+
writer_class = animation.writers[writer]
156+
for frame_format in getattr(writer_class, 'supported_formats', [None]):
157+
yield writer, frame_format, output
158+
yield writer, frame_format, Path(output)
146159

147160

148161
# Smoke test for saving animations. In the future, we should probably
149162
# design more sophisticated tests which compare resulting frames a-la
150163
# matplotlib.testing.image_comparison
151-
@pytest.mark.parametrize('writer, output', WRITER_OUTPUT)
164+
@pytest.mark.parametrize('writer, frame_format, output', gen_writers())
152165
@pytest.mark.parametrize('anim', [dict(klass=dict)], indirect=['anim'])
153-
def test_save_animation_smoketest(tmpdir, writer, output, anim):
154-
if not animation.writers.is_available(writer):
155-
pytest.skip("writer '%s' not available on this system" % writer)
156-
166+
def test_save_animation_smoketest(tmpdir, writer, frame_format, output, anim):
167+
if frame_format is not None:
168+
plt.rcParams["animation.frame_format"] = frame_format
157169
anim = animation.FuncAnimation(**anim)
158170
dpi = None
159171
codec = None

0 commit comments

Comments
 (0)
0