Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make test_save_animation_smoketest actually run #2679

Merged
merged 4 commits into from Dec 20, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions lib/matplotlib/__init__.py
Expand Up @@ -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',
Expand Down
16 changes: 11 additions & 5 deletions lib/matplotlib/tests/test_animation.py
Expand Up @@ -3,15 +3,14 @@

import six

import os
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',
Expand All @@ -23,16 +22,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([], [])

Expand All @@ -49,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__":
Expand Down