3
3
4
4
import six
5
5
6
- import os
7
6
import tempfile
8
7
9
8
import numpy as np
10
-
9
+ from nose import with_setup
11
10
from matplotlib import pyplot as plt
12
11
from matplotlib import animation
13
12
from matplotlib .testing .noseclasses import KnownFailureTest
14
- from matplotlib .testing .decorators import cleanup
13
+ from matplotlib .testing .decorators import CleanupTest
15
14
16
15
17
16
WRITER_OUTPUT = dict (ffmpeg = 'mp4' , ffmpeg_file = 'mp4' ,
23
22
# Smoke test for saving animations. In the future, we should probably
24
23
# design more sophisticated tests which compare resulting frames a-la
25
24
# matplotlib.testing.image_comparison
26
- @cleanup
27
25
def test_save_animation_smoketest ():
28
26
for writer , extension in six .iteritems (WRITER_OUTPUT ):
29
27
yield check_save_animation , writer , extension
30
28
31
29
30
+ @with_setup (CleanupTest .setup_class , CleanupTest .teardown_class )
32
31
def check_save_animation (writer , extension = 'mp4' ):
33
32
if not animation .writers .is_available (writer ):
34
33
raise KnownFailureTest ("writer '%s' not available on this system"
35
34
% writer )
35
+ if 'mencoder' in writer :
36
+ raise KnownFailureTest ("mencoder is broken" )
36
37
fig , ax = plt .subplots ()
37
38
line , = ax .plot ([], [])
38
39
@@ -49,7 +50,12 @@ def animate(i):
49
50
# Use NamedTemporaryFile: will be automatically deleted
50
51
F = tempfile .NamedTemporaryFile (suffix = '.' + extension )
51
52
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" )
53
59
54
60
55
61
if __name__ == "__main__" :
0 commit comments