MCPcopy
hub / github.com/pytest-dev/pytest / test_popen_stdin_pipe

Function test_popen_stdin_pipe

testing/test_pytester.py:646–657  ·  view source on GitHub ↗
(pytester: Pytester)

Source from the content-addressed store, hash-verified

644
645
646def test_popen_stdin_pipe(pytester: Pytester) -> None:
647 proc = pytester.popen(
648 [sys.executable, "-c", "import sys; print(sys.stdin.read())"],
649 stdout=subprocess.PIPE,
650 stderr=subprocess.PIPE,
651 stdin=subprocess.PIPE,
652 )
653 stdin = b"input\n2ndline"
654 stdout, stderr = proc.communicate(input=stdin)
655 assert stdout.decode("utf8").splitlines() == ["input", "2ndline"]
656 assert stderr == b""
657 assert proc.returncode == 0
658
659
660def test_popen_stdin_bytes(pytester: Pytester) -> None:

Callers

nothing calls this directly

Calls 1

popenMethod · 0.45

Tested by

no test coverage detected