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)
| 1454 | reason=class="st">"Windows raises `OSError: [Errno 22] Invalid argument` instead", |
| 1455 | ) |
| 1456 | def 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") |
nothing calls this directly
no test coverage detected