(self)
| 510 | |
| 511 | @force_not_colorized |
| 512 | def test_stdout_flush_at_shutdown(self): |
| 513 | # Issue #5319: if stdout.flush() fails at shutdown, an error should |
| 514 | # be printed out. |
| 515 | code = """if 1: |
| 516 | import os, sys, test.support |
| 517 | test.support.SuppressCrashReport().__enter__() |
| 518 | sys.stdout.write('x') |
| 519 | os.close(sys.stdout.fileno())""" |
| 520 | rc, out, err = assert_python_failure('-c', code) |
| 521 | self.assertEqual(b'', out) |
| 522 | self.assertEqual(120, rc) |
| 523 | self.assertIn(b'Exception ignored while flushing sys.stdout:\n' |
| 524 | b'OSError: '.replace(b'\n', os.linesep.encode()), |
| 525 | err) |
| 526 | |
| 527 | def test_closed_stdout(self): |
| 528 | # Issue #13444: if stdout has been explicitly closed, we should |
nothing calls this directly
no test coverage detected