8000 #1: add tests for ffmpeg.run with cmd list · Powercoder64/ffmpeg-python@cfe2995 · GitHub
[go: up one dir, main page]

Skip to content

Commit cfe2995

Browse files
committed
kkroening#1: add tests for ffmpeg.run with cmd list
1 parent a51cfe7 commit cfe2995

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

ffmpeg/_run.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,10 @@ def get_args(node):
106106
def run(node, cmd='ffmpeg'):
107107
"""Run ffmpeg on node graph."""
108108
if isinstance(cmd, basestring):
109-
args = [cmd]
109+
cmd = [cmd]
110110
elif type(cmd) != list:
111-
args = list(cmd)
112-
args += node.get_args()
111+
cmd = list(cmd)
112+
args = cmd + node.get_args()
113113
_subprocess.check_call(args)
114114

115115

ffmpeg/tests/test_ffmpeg.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import ffmpeg
22
import os
3+
import pytest
34
import subprocess
45

56

@@ -118,4 +119,21 @@ def test_get_args_complex_filter():
118119

119120

120121
def test_run():
121-
ffmpeg.run(_get_complex_filter_example())
122+
node = _get_complex_filter_example()
123+
ffmpeg.run(node)
124+
125+
126+
def test_run_dummy_cmd():
127+
node = _get_complex_filter_example()
128+
ffmpeg.run(node, cmd='true')
129+
130+
131+
def test_run_dummy_cmd_list():
132+
node = _get_complex_filter_example()
133+
ffmpeg.run(node, cmd=['true', 'ignored'])
134+
135+
136+
def test_run_failing_cmd():
137+
node = _get_complex_filter_example()
138+
with pytest.raises(subprocess.CalledProcessError):
139+
ffmpeg.run(node, cmd='false')

0 commit comments

Comments
 (0)
0