MCPcopy Index your code
hub / github.com/python/cpython / test_flush_error_on_close

Method test_flush_error_on_close

Lib/test/test_io/test_general.py:552–574  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

550 f.flush = lambda: None # break reference loop
551
552 def test_flush_error_on_close(self):
553 # raw file
554 # Issue #5700: io.FileIO calls flush() after file closed
555 self.check_flush_error_on_close(os_helper.TESTFN, 'wb', buffering=0)
556 fd = os.open(os_helper.TESTFN, os.O_WRONLY|os.O_CREAT)
557 self.check_flush_error_on_close(fd, 'wb', buffering=0)
558 fd = os.open(os_helper.TESTFN, os.O_WRONLY|os.O_CREAT)
559 self.check_flush_error_on_close(fd, 'wb', buffering=0, closefd=False)
560 os.close(fd)
561 # buffered io
562 self.check_flush_error_on_close(os_helper.TESTFN, 'wb')
563 fd = os.open(os_helper.TESTFN, os.O_WRONLY|os.O_CREAT)
564 self.check_flush_error_on_close(fd, 'wb')
565 fd = os.open(os_helper.TESTFN, os.O_WRONLY|os.O_CREAT)
566 self.check_flush_error_on_close(fd, 'wb', closefd=False)
567 os.close(fd)
568 # text io
569 self.check_flush_error_on_close(os_helper.TESTFN, 'w', encoding="utf-8")
570 fd = os.open(os_helper.TESTFN, os.O_WRONLY|os.O_CREAT)
571 self.check_flush_error_on_close(fd, 'w', encoding="utf-8")
572 fd = os.open(os_helper.TESTFN, os.O_WRONLY|os.O_CREAT)
573 self.check_flush_error_on_close(fd, 'w', encoding="utf-8", closefd=False)
574 os.close(fd)
575
576 def test_multi_close(self):
577 f = self.open(os_helper.TESTFN, "wb", buffering=0)

Callers

nothing calls this directly

Calls 3

openMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected