(self)
| 476 | self.assertEqual(b'', out) |
| 477 | |
| 478 | def test_stdout_flush_at_shutdown(self): |
| 479 | # Issue #5319: if stdout.flush() fails at shutdown, an error should |
| 480 | # be printed out. |
| 481 | code = """if 1: |
| 482 | import os, sys, test.support |
| 483 | test.support.SuppressCrashReport().__enter__() |
| 484 | sys.stdout.write('x') |
| 485 | os.close(sys.stdout.fileno())""" |
| 486 | rc, out, err = assert_python_failure('-c', code) |
| 487 | self.assertEqual(b'', out) |
| 488 | self.assertEqual(120, rc) |
| 489 | self.assertRegex(err.decode('ascii', 'ignore'), |
| 490 | 'Exception ignored in.*\nOSError: .*') |
| 491 | |
| 492 | def test_closed_stdout(self): |
| 493 | # Issue #13444: if stdout has been explicitly closed, we should |
nothing calls this directly
no test coverage detected