From 078c0aece7bae483e98899d14ae2277fb5558a62 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Thu, 12 Dec 2013 15:59:06 -0600 Subject: [PATCH 1/4] Make `test_save_animation_smoketest` actually run Marked mencoder as KnownFailure --- lib/matplotlib/tests/test_animation.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/matplotlib/tests/test_animation.py b/lib/matplotlib/tests/test_animation.py index 04fb65291b5b..33d36252e891 100644 --- a/lib/matplotlib/tests/test_animation.py +++ b/lib/matplotlib/tests/test_animation.py @@ -7,11 +7,12 @@ import tempfile import numpy as np - +from nose import with_setup from matplotlib import pyplot as plt from matplotlib import animation from matplotlib.testing.noseclasses import KnownFailureTest from matplotlib.testing.decorators import cleanup +from matplotlib.testing.decorators import CleanupTest WRITER_OUTPUT = dict(ffmpeg='mp4', ffmpeg_file='mp4', @@ -23,16 +24,18 @@ # Smoke test for saving animations. In the future, we should probably # design more sophisticated tests which compare resulting frames a-la # matplotlib.testing.image_comparison -@cleanup def test_save_animation_smoketest(): for writer, extension in six.iteritems(WRITER_OUTPUT): yield check_save_animation, writer, extension +@with_setup(CleanupTest.setup_class, CleanupTest.teardown_class) def check_save_animation(writer, extension='mp4'): if not animation.writers.is_available(writer): raise KnownFailureTest("writer '%s' not available on this system" % writer) + if 'mencoder' in writer: + raise KnownFailureTest("mencoder is broken") fig, ax = plt.subplots() line, = ax.plot([], []) From cca8256df44f9f540112f72c39f4d86f9ef084fc Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Thu, 12 Dec 2013 22:49:55 -0600 Subject: [PATCH 2/4] added test_animation to default_test_modules so the tests run --- lib/matplotlib/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/matplotlib/__init__.py b/lib/matplotlib/__init__.py index cbeba3cb394a..9e83feeb644b 100644 --- a/lib/matplotlib/__init__.py +++ b/lib/matplotlib/__init__.py @@ -1292,6 +1292,7 @@ def tk_window_focus(): default_test_modules = [ 'matplotlib.tests.test_agg', + 'matplotlib.tests.test_animation', 'matplotlib.tests.test_arrow_patches', 'matplotlib.tests.test_artist', 'matplotlib.tests.test_axes', From 61bce5ddc20cdef650a6cf2c5ff05898a665ea04 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Thu, 19 Dec 2013 10:41:39 -0600 Subject: [PATCH 3/4] added try-catch block to test_animation to deal with strange import errors coming out of numpy. See issue #1891. --- lib/matplotlib/tests/test_animation.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/matplotlib/tests/test_animation.py b/lib/matplotlib/tests/test_animation.py index 33d36252e891..34b647d7890d 100644 --- a/lib/matplotlib/tests/test_animation.py +++ b/lib/matplotlib/tests/test_animation.py @@ -3,7 +3,6 @@ import six -import os import tempfile import numpy as np @@ -11,7 +10,6 @@ from matplotlib import pyplot as plt from matplotlib import animation from matplotlib.testing.noseclasses import KnownFailureTest -from matplotlib.testing.decorators import cleanup from matplotlib.testing.decorators import CleanupTest @@ -52,7 +50,12 @@ def animate(i): # Use NamedTemporaryFile: will be automatically deleted F = tempfile.NamedTemporaryFile(suffix='.' + extension) anim = animation.FuncAnimation(fig, animate, init_func=init, frames=5) - anim.save(F.name, fps=30, writer=writer) + try: + anim.save(F.name, fps=30, writer=writer) + except UnicodeDecodeError: + raise KnownFailureTest("There can be errors in the numpy " + + "import stack, " + + "see issues #1891 and #2679") if __name__ == "__main__": From b4ba1d4483dba35de80bbfa45effe0958a000b87 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Thu, 19 Dec 2013 10:44:39 -0600 Subject: [PATCH 4/4] added libav-tools to the packages installed so that more of the animation smoke tests will run. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 4487f4af66d9..8b206833970f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,7 +18,7 @@ python: install: - pip install -q --use-mirrors nose python-dateutil numpy pep8 pyparsing pillow - - sudo apt-get update && sudo apt-get -qq install inkscape + - sudo apt-get update && sudo apt-get -qq install inkscape libav-tools - python setup.py install script: