(self)
| 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", |
nothing calls this directly
no test coverage detected