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

Method test_master_read

Lib/test/test_pty.py:280–297  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

278 ## raise TestFailed("Read from master_fd did not raise exception")
279
280 def test_master_read(self):
281 # XXX(nnorwitz): this test leaks fds when there is an error.
282 debug("Calling pty.openpty()")
283 master_fd, slave_fd = pty.openpty()
284 debug(f"Got master_fd '{master_fd}', slave_fd '{slave_fd}'")
285
286 self.addCleanup(os.close, master_fd)
287
288 debug("Closing slave_fd")
289 os.close(slave_fd)
290
291 debug("Reading from master_fd")
292 try:
293 data = os.read(master_fd, 1)
294 except OSError: # Linux
295 data = b""
296
297 self.assertEqual(data, b"")
298
299 @warnings_helper.ignore_fork_in_thread_deprecation_warnings()
300 def test_spawn_doesnt_hang(self):

Callers

nothing calls this directly

Calls 5

addCleanupMethod · 0.80
debugFunction · 0.70
closeMethod · 0.45
readMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected