FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Revert "Revert "Implemented cwd parameter"" by depau · Pull Request #494 · kkroening/ffmpeg-python · GitHub

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (2) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
6 changes: 5 additions & 1 deletion ffmpeg/_run.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ def run_async(
pipe_stderr=False,
quiet=False,
overwrite_output=False,
cwd=None
):
"""Asynchronously invoke ffmpeg for the supplied node graph.

Expand Down Expand Up @@ -285,7 +286,8 @@ def run_async(
stderr_stream = subprocess.STDOUT
stdout_stream = subprocess.DEVNULL
return subprocess.Popen(
args, stdin=stdin_stream, stdout=stdout_stream, stderr=stderr_stream
args, stdin=stdin_stream, stdout=stdout_stream, stderr=stderr_stream,
cwd=cwd
)


Expand All @@ -298,6 +300,7 @@ def run(
input=None,
quiet=False,
overwrite_output=False,
cwd=None
):
"""Invoke ffmpeg for the supplied node graph.

Expand All @@ -321,6 +324,7 @@ def run(
pipe_stderr=capture_stderr,
quiet=quiet,
overwrite_output=overwrite_output,
cwd=cwd
)
out, err = process.communicate(input)
retcode = process.poll()
Expand Down
9 changes: 6 additions & 3 deletions ffmpeg/tests/test_ffmpeg.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -441,12 +441,14 @@ def test__compile():
@pytest.mark.parametrize('pipe_stdin', [True, False])
@pytest.mark.parametrize('pipe_stdout', [True, False])
@pytest.mark.parametrize('pipe_stderr', [True, False])
def test__run_async(mocker, pipe_stdin, pipe_stdout, pipe_stderr):
@pytest.mark.parametrize('cwd', [None, '/tmp'])
def test__run_async(mocker, pipe_stdin, pipe_stdout, pipe_stderr, cwd):
process__mock = mock.Mock()
popen__mock = mocker.patch.object(subprocess, 'Popen', return_value=process__mock)
stream = _get_simple_example()
process = ffmpeg.run_async(
stream, pipe_stdin=pipe_stdin, pipe_stdout=pipe_stdout, pipe_stderr=pipe_stderr
stream, pipe_stdin=pipe_stdin, pipe_stdout=pipe_stdout,
pipe_stderr=pipe_stderr, cwd=cwd
)
assert process is process__mock

Expand All @@ -456,7 +458,8 @@ def test__run_async(mocker, pipe_stdin, pipe_stdout, pipe_stderr):
(args,), kwargs = popen__mock.call_args
assert args == ffmpeg.compile(stream)
assert kwargs == dict(
stdin=expected_stdin, stdout=expected_stdout, stderr=expected_stderr
stdin=expected_stdin, stdout=expected_stdout, stderr=expected_stderr,
cwd=cwd
)


Expand Down

Back | FazBrowse Home | New Git URL