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="Windows raises `OSError: [Errno 22] Invalid argument` instead", |
| 1455 | ) |
| 1456 | def test_no_brokenpipeerror_message(pytester: Pytester) -> None: |
| 1457 | """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 | """ |
| 1463 | popen = pytester.popen((*pytester._getpytestargs(), "--help")) |
| 1464 | popen.stdout.close() |
| 1465 | ret = popen.wait() |
| 1466 | assert popen.stderr.read() == b"" |
| 1467 | assert ret == 1 |
| 1468 | |
| 1469 | # Cleanup. |
| 1470 | popen.stderr.close() |
| 1471 | |
| 1472 | |
| 1473 | @pytest.mark.filterwarnings("default") |
nothing calls this directly
no test coverage detected
searching dependent graphs…