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

Method test_timeout

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

Source from the content-addressed store, hash-verified

5801
5802 @warnings_helper.ignore_fork_in_thread_deprecation_warnings()
5803 def test_timeout(self):
5804 old_timeout = socket.getdefaulttimeout()
5805 try:
5806 socket.setdefaulttimeout(0.1)
5807 parent, child = multiprocessing.Pipe(duplex=True)
5808 l = multiprocessing.connection.Listener(family='AF_INET')
5809 p = multiprocessing.Process(target=self._test_timeout,
5810 args=(child, l.address))
5811 p.start()
5812 child.close()
5813 self.assertEqual(parent.recv(), 123)
5814 parent.close()
5815 conn = l.accept()
5816 self.assertEqual(conn.recv(), 456)
5817 conn.close()
5818 l.close()
5819 join_process(p)
5820 finally:
5821 socket.setdefaulttimeout(old_timeout)
5822
5823#
5824# Test what happens with no "if __name__ == '__main__'"

Callers

nothing calls this directly

Calls 9

acceptMethod · 0.95
closeMethod · 0.95
join_processFunction · 0.85
PipeMethod · 0.80
ProcessMethod · 0.45
startMethod · 0.45
closeMethod · 0.45
assertEqualMethod · 0.45
recvMethod · 0.45

Tested by

no test coverage detected