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

Function test_no_brokenpipeerror_message

testing/acceptance_test.py:1456–1470  ·  testing/acceptance_test.py::test_no_brokenpipeerror_message

Ensure that the broken pipe error message is suppressed. In some Python versions, it reaches sys.unraisablehook, in others a BrokenPipeError exception is propagated, but either way it prints to stderr on shutdown, so checking nothing is printed is enough.

(pytester: Pytester)

Source from the content-addressed store, hash-verified

1454 reason=class="st">"Windows raises `OSError: [Errno 22] Invalid argument` instead",
1455)
1456def test_no_brokenpipeerror_message(pytester: Pytester) -> None:
1457 class="st">"""Ensure that the broken pipe error message is suppressed.
1458
1459 In some Python versions, it reaches sys.unraisablehook, in others
1460 a BrokenPipeError exception is propagated, but either way it prints
1461 to stderr on shutdown, so checking nothing is printed is enough.
1462 class="st">"""
1463 popen = pytester.popen((*pytester._getpytestargs(), class="st">"--help"))
1464 popen.stdout.close()
1465 ret = popen.wait()
1466 assert popen.stderr.read() == bclass="st">""
1467 assert ret == 1
1468
1469 class="cm"># Cleanup.
1470 popen.stderr.close()
1471
1472
1473@pytest.mark.filterwarnings(class="st">"default")

Callers

nothing calls this directly

Calls 4

_getpytestargsMethod · 0.80
popenMethod · 0.45
closeMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected