MCPcopy
hub / github.com/Textualize/rich / test_brokenpipeerror

Function test_brokenpipeerror

tests/test_console.py:1007–1023  ·  tests/test_console.py::test_brokenpipeerror

Test BrokenPipe works as expected.

()

Source from the content-addressed store, hash-verified

1005
1006@pytest.mark.skipif(sys.platform == class="st">"win32", reason=class="st">"does not run on windows")
1007def test_brokenpipeerror() -> None:
1008 class="st">""class="st">"Test BrokenPipe works as expected."class="st">""
1009 which_py, which_head = ([class="st">"which", cmd] for cmd in (class="st">"python", class="st">"head"))
1010 rich_cmd = class="st">"python -m rich".split()
1011 for cmd in [which_py, which_head, rich_cmd]:
1012 check = subprocess.run(cmd).returncode
1013 if check != 0:
1014 return class="cm"># Only test on suitable Unix platforms
1015 head_cmd = class="st">"head -1".split()
1016 proc1 = subprocess.Popen(rich_cmd, stdout=subprocess.PIPE)
1017 proc2 = subprocess.Popen(head_cmd, stdin=proc1.stdout, stdout=subprocess.PIPE)
1018 proc1.stdout.close()
1019 output, _ = proc2.communicate()
1020 proc1.wait()
1021 proc2.wait()
1022 assert proc1.returncode == 1
1023 assert proc2.returncode == 0
1024
1025
1026def test_capture_and_record() -> None:

Callers

nothing calls this directly

Calls 3

splitMethod · 0.45
runMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected