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

Method test_spawn_close

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

Source from the content-addressed store, hash-verified

3777
3778 @warnings_helper.ignore_fork_in_thread_deprecation_warnings()
3779 def test_spawn_close(self):
3780 # We test that a pipe connection can be closed by parent
3781 # process immediately after child is spawned. On Windows this
3782 # would have sometimes failed on old versions because
3783 # child_conn would be closed before the child got a chance to
3784 # duplicate it.
3785 conn, child_conn = self.Pipe()
3786
3787 p = self.Process(target=self._echo, args=(child_conn,))
3788 p.daemon = True
3789 p.start()
3790 child_conn.close() # this might complete before child initializes
3791
3792 msg = latin('hello')
3793 conn.send_bytes(msg)
3794 self.assertEqual(conn.recv_bytes(), msg)
3795
3796 conn.send_bytes(SENTINEL)
3797 conn.close()
3798 p.join()
3799
3800 def test_sendbytes(self):
3801 if self.TYPE != 'processes':

Callers

nothing calls this directly

Calls 9

latinFunction · 0.85
PipeMethod · 0.80
ProcessMethod · 0.45
startMethod · 0.45
closeMethod · 0.45
send_bytesMethod · 0.45
assertEqualMethod · 0.45
recv_bytesMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected