@@ -71,25 +71,39 @@ def is_functional(self):
7171 import os
7272 base , filename_png = os .path .split (base_filename_png )
7373 filename , _png = os .path .splitext (filename_png )
74- filename_gif = filename + '.gif'
7574
76- # running the command (taken from sage/plot/animate.py)
77- from subprocess import run
78- # the `-nostdin` is needed to avoid the command to hang, see
75+ # Setting a list of commands (taken from sage/plot/animate.py)
76+ # The `-nostdin` is needed to avoid the command to hang, see
7977 # https://stackoverflow.com/questions/16523746/ffmpeg-hangs-when-run-in-background
80- cmd = ['ffmpeg' , '-nostdin' , '-y' , '-f' , 'image2' , '-r' , '5' , '-i' ,
81- filename_png , '-pix_fmt' , 'rgb24' , '-loop' , '0' ,
82- filename_gif ]
83- result = run (cmd , cwd = base , capture_output = True , text = True )
84-
85- # If an error occured, return False
86- if result .returncode :
87- return FeatureTestResult (self , False , reason = 'Running command "{}" '
88- 'returned non-zero exit status "{}" with stderr '
89- '"{}" and stdout "{}".' .format (result .args ,
90- result .returncode ,
91- result .stderr .strip (),
92- result .stdout .strip ()))
78+ commands = []
79+ for ext in ['.avi' , '.flv' , '.gif' , '.mkv' , '.mov' , #'.mpg',
80+ '.mp4' , '.ogg' , '.ogv' , '.webm' , '.wmv' ]:
81+
82+ cmd = ['ffmpeg' , '-nostdin' , '-y' , '-f' , 'image2' , '-r' , '5' ,
83+ '-i' , filename_png , '-pix_fmt' , 'rgb24' , '-loop' , '0' ,
84+ filename + ext ]
85+ commands .append (cmd )
86+
87+ for ext in ['.avi' , '.flv' , '.gif' , '.mkv' , '.mov' , '.mpg' ,
88+ '.mp4' , '.ogg' , '.ogv' , '.webm' , '.wmv' ]:
89+
90+ cmd = ['ffmpeg' , '-nostdin' , '-y' , '-f' , 'image2' , '-i' ,
91+ filename_png , filename + ext ]
92+ commands .append (cmd )
93+
94+ # Running the commands and reporting any issue encountered
95+ from subprocess import run
96+ for cmd in commands :
97+ result = run (cmd , cwd = base , capture_output = True , text = True )
98+
99+ # If an error occurred, return False
100+ if result .returncode :
101+ return FeatureTestResult (self , False , reason = 'Running command "{}" '
102+ 'returned non-zero exit status "{}" with stderr '
103+ '"{}" and stdout "{}".' .format (result .args ,
104+ result .returncode ,
105+ result .stderr .strip (),
106+ result .stdout .strip ()))
93107
94108 # If necessary, run more tests here
95109 # ...
0 commit comments