Skip to content

Commit 263c1b9

Browse files
committed
Merge pull request #2679 from tacaswell/fix_animation_tests
Make `test_save_animation_smoketest` actually run
2 parents 6afba8d + b4ba1d4 commit 263c1b9

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ python:
1818

1919
install:
2020
- pip install -q --use-mirrors nose python-dateutil numpy pep8 pyparsing pillow
21-
- sudo apt-get update && sudo apt-get -qq install inkscape
21+
- sudo apt-get update && sudo apt-get -qq install inkscape libav-tools
2222
- python setup.py install
2323

2424
script:

lib/matplotlib/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1296,6 +1296,7 @@ def tk_window_focus():
12961296

12971297
default_test_modules = [
12981298
'matplotlib.tests.test_agg',
1299+
'matplotlib.tests.test_animation',
12991300
'matplotlib.tests.test_arrow_patches',
13001301
'matplotlib.tests.test_artist',
13011302
'matplotlib.tests.test_axes',

lib/matplotlib/tests/test_animation.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,14 @@
33

44
import six
55

6-
import os
76
import tempfile
87

98
import numpy as np
10-
9+
from nose import with_setup
1110
from matplotlib import pyplot as plt
1211
from matplotlib import animation
1312
from matplotlib.testing.noseclasses import KnownFailureTest
14-
from matplotlib.testing.decorators import cleanup
13+
from matplotlib.testing.decorators import CleanupTest
1514

1615

1716
WRITER_OUTPUT = dict(ffmpeg='mp4', ffmpeg_file='mp4',
@@ -23,16 +22,18 @@
2322
# Smoke test for saving animations. In the future, we should probably
2423
# design more sophisticated tests which compare resulting frames a-la
2524
# matplotlib.testing.image_comparison
26-
@cleanup
2725
def test_save_animation_smoketest():
2826
for writer, extension in six.iteritems(WRITER_OUTPUT):
2927
yield check_save_animation, writer, extension
3028

3129

30+
@with_setup(CleanupTest.setup_class, CleanupTest.teardown_class)
3231
def check_save_animation(writer, extension='mp4'):
3332
if not animation.writers.is_available(writer):
3433
raise KnownFailureTest("writer '%s' not available on this system"
3534
% writer)
35+
if 'mencoder' in writer:
36+
raise KnownFailureTest("mencoder is broken")
3637
fig, ax = plt.subplots()
3738
line, = ax.plot([], [])
3839

@@ -49,7 +50,12 @@ def animate(i):
4950
# Use NamedTemporaryFile: will be automatically deleted
5051
F = tempfile.NamedTemporaryFile(suffix='.' + extension)
5152
anim = animation.FuncAnimation(fig, animate, init_func=init, frames=5)
52-
anim.save(F.name, fps=30, writer=writer)
53+
try:
54+
anim.save(F.name, fps=30, writer=writer)
55+
except UnicodeDecodeError:
56+
raise KnownFailureTest("There can be errors in the numpy " +
57+
"import stack, " +
58+
"see issues #1891 and #2679")
5359

5460

5561
if __name__ == "__main__":

0 commit comments

Comments
 (0)