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

Method test_read_non_blocking

Lib/test/test_io/test_textio.py:1413–1426  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1411
1412 @unittest.skipUnless(hasattr(os, "pipe"), "requires os.pipe()")
1413 def test_read_non_blocking(self):
1414 import os
1415 r, w = os.pipe()
1416 try:
1417 os.set_blocking(r, False)
1418 with self.io.open(r, 'rt') as textfile:
1419 r = None
1420 # Nothing has been written so a non-blocking read raises a BlockingIOError exception.
1421 with self.assertRaises(BlockingIOError):
1422 textfile.read()
1423 finally:
1424 if r is not None:
1425 os.close(r)
1426 os.close(w)
1427
1428
1429class MemviewBytesIO(io.BytesIO):

Callers

nothing calls this directly

Calls 5

pipeMethod · 0.45
openMethod · 0.45
assertRaisesMethod · 0.45
readMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected