Skip to content

Commit

Permalink
Merge pull request #2039 from manuco/main
Browse files Browse the repository at this point in the history
Add a test which checks that fifos outputs are not read
  • Loading branch information
webknjaz committed Jan 5, 2024
2 parents c21525b + 7d8d1eb commit 41b3c0e
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/test_cli_compile.py
Expand Up @@ -3576,3 +3576,26 @@ def test_tool_specific_config_option(pip_conf, runner, tmp_path, make_config_fil

assert out.exit_code == 0
assert "Dry-run, so nothing updated" in out.stderr


@pytest.mark.xfail(reason="https://github.com/jazzband/pip-tools/issues/2012")
@mock.patch("piptools.scripts.compile.parse_requirements")
def test_stdout_should_not_be_read_when_stdin_is_not_a_plain_file(
parse_req,
runner,
tmp_path,
):
parse_req.side_effect = lambda fname, finder, options, session: pytest.fail(
"Must not be called when output is a fifo"
)

req_in = tmp_path / "requirements.txt"
req_in.touch()

fifo = tmp_path / "fifo"

os.mkfifo(fifo)

out = runner.invoke(cli, [req_in.as_posix(), "--output-file", fifo.as_posix()])

assert out.exit_code == 0, out

0 comments on commit 41b3c0e

Please sign in to comment.