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

Method test_fd_transfer

Lib/test/_test_multiprocessing.py:3570–3586  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

3568
3569 @unittest.skipUnless(HAS_REDUCTION, "test needs multiprocessing.reduction")
3570 def test_fd_transfer(self):
3571 if self.TYPE != 'processes':
3572 self.skipTest("only makes sense with processes")
3573 conn, child_conn = self.Pipe(duplex=True)
3574
3575 p = self.Process(target=self._writefd, args=(child_conn, b"foo"))
3576 p.daemon = True
3577 p.start()
3578 self.addCleanup(os_helper.unlink, os_helper.TESTFN)
3579 with open(os_helper.TESTFN, "wb") as f:
3580 fd = f.fileno()
3581 if msvcrt:
3582 fd = msvcrt.get_osfhandle(fd)
3583 reduction.send_handle(conn, fd, p.pid)
3584 p.join()
3585 with open(os_helper.TESTFN, "rb") as f:
3586 self.assertEqual(f.read(), b"foo")
3587
3588 @unittest.skipUnless(HAS_REDUCTION, "test needs multiprocessing.reduction")
3589 @unittest.skipIf(sys.platform == "win32",

Callers

nothing calls this directly

Calls 10

skipTestMethod · 0.80
PipeMethod · 0.80
addCleanupMethod · 0.80
openFunction · 0.50
ProcessMethod · 0.45
startMethod · 0.45
filenoMethod · 0.45
joinMethod · 0.45
assertEqualMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected