MCPcopy Index your code
hub / github.com/Textualize/rich / test_brokenpipeerror

Function test_brokenpipeerror

tests/test_console.py:1007–1023  ·  view source on GitHub ↗

Test BrokenPipe works as expected.

()

Source from the content-addressed store, hash-verified

1005
1006@pytest.mark.skipif(sys.platform == "win32", reason="does not run on windows")
1007def test_brokenpipeerror() -> None:
1008 """Test BrokenPipe works as expected."""
1009 which_py, which_head = (["which", cmd] for cmd in ("python", "head"))
1010 rich_cmd = "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 # Only test on suitable Unix platforms
1015 head_cmd = "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

Used in the wild real call sites across dependent graphs

searching dependent graphs…