MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_stdout_flush_at_shutdown

Method test_stdout_flush_at_shutdown

Lib/test/test_cmd_line.py:478–490  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 4

assert_python_failureFunction · 0.90
assertRegexMethod · 0.80
assertEqualMethod · 0.45
decodeMethod · 0.45

Tested by

no test coverage detected