Skip to content

Commit 2a421bb

Browse files
committed
!squash more
1 parent d11adde commit 2a421bb

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

tests/_internal/subprocess/test_mixins.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,29 @@ def test_Popen_mock(
4343
response = cmd.Popen(**run_kwargs)
4444

4545
assert response.returncode == 1
46+
47+
48+
@pytest.mark.parametrize(
49+
"args,kwargs,run_kwargs",
50+
[
51+
[[["git", "pull", "--progress"]], {}, {}],
52+
],
53+
ids=idfn,
54+
)
55+
@mock.patch("subprocess.Popen")
56+
def test_Popen_git_mock(
57+
mock_subprocess_popen,
58+
tmp_path: pathlib.Path,
59+
args: list,
60+
kwargs: dict,
61+
run_kwargs: dict,
62+
capsys: pytest.LogCaptureFixture,
63+
):
64+
process_mock = mock.Mock()
65+
attrs = {"communicate.return_value": ("output", "error"), "returncode": 1}
66+
process_mock.configure_mock(**attrs)
67+
mock_subprocess_popen.return_value = process_mock
68+
cmd = SubprocessCommand(*args, cwd=tmp_path, **kwargs)
69+
response = cmd.Popen(**run_kwargs)
70+
71+
assert response.returncode == 1

0 commit comments

Comments
 (0)