Skip to content

Commit

Permalink
!squash more
Browse files Browse the repository at this point in the history
  • Loading branch information
tony committed May 15, 2022
1 parent d11adde commit 2a421bb
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/_internal/subprocess/test_mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,29 @@ def test_Popen_mock(
response = cmd.Popen(**run_kwargs)

assert response.returncode == 1


@pytest.mark.parametrize(
"args,kwargs,run_kwargs",
[
[[["git", "pull", "--progress"]], {}, {}],
],
ids=idfn,
)
@mock.patch("subprocess.Popen")
def test_Popen_git_mock(
mock_subprocess_popen,
tmp_path: pathlib.Path,
args: list,
kwargs: dict,
run_kwargs: dict,
capsys: pytest.LogCaptureFixture,
):
process_mock = mock.Mock()
attrs = {"communicate.return_value": ("output", "error"), "returncode": 1}
process_mock.configure_mock(**attrs)
mock_subprocess_popen.return_value = process_mock
cmd = SubprocessCommand(*args, cwd=tmp_path, **kwargs)
response = cmd.Popen(**run_kwargs)

assert response.returncode == 1

0 comments on commit 2a421bb

Please sign in to comment.