File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -19,10 +19,11 @@ def probe(filename):
19
19
p = subprocess .Popen (args , stdout = subprocess .PIPE , stderr = subprocess .PIPE )
20
20
out , err = p .communicate ()
21
21
if p .returncode != 0 :
22
- raise ExecException (err )
22
+ raise ProbeException (err )
23
23
return json .loads (out .decode ('utf-8' ))
24
24
25
25
26
26
__all__ = [
27
27
'probe' ,
28
+ 'ProbeException' ,
28
29
]
Original file line number Diff line number Diff line change 16
16
TEST_OVERLAY_FILE = os .path .join (SAMPLE_DATA_DIR , 'overlay.png' )
17
17
TEST_OUTPUT_FILE1 = os .path .join (SAMPLE_DATA_DIR , 'out1.mp4' )
18
18
TEST_OUTPUT_FILE2 = os .path .join (SAMPLE_DATA_DIR , 'out2.mp4' )
19
+ BOGUS_INPUT_FILE = os .path .join (SAMPLE_DATA_DIR , 'bogus' )
19
20
20
21
21
22
subprocess .check_call (['ffmpeg' , '-version' ])
@@ -359,3 +360,10 @@ def test_ffprobe():
359
360
data = ffmpeg .probe (TEST_INPUT_FILE1 )
360
361
assert set (data .keys ()) == {'format' , 'streams' }
361
362
assert data ['format' ]['duration' ] == '7.036000'
363
+
364
+
365
+ def test_ffprobe_exception ():
366
+ with pytest .raises (ffmpeg .ProbeException ) as excinfo :
367
+ ffmpeg .probe (BOGUS_INPUT_FILE )
368
+ assert excinfo .value .message == 'ffprobe error'
369
+ assert 'No such file or directory' in excinfo .value .stderr_output
You can’t perform that action at this time.
0 commit comments