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

Method test_wait

Lib/test/_test_multiprocessing.py:5246–5274  ·  view source on GitHub ↗
(self, slow=False)

Source from the content-addressed store, hash-verified

5244 w.close()
5245
5246 def test_wait(self, slow=False):
5247 from multiprocessing.connection import wait
5248 readers = []
5249 procs = []
5250 messages = []
5251
5252 for i in range(4):
5253 r, w = multiprocessing.Pipe(duplex=False)
5254 p = multiprocessing.Process(target=self._child_test_wait, args=(w, slow))
5255 p.daemon = True
5256 p.start()
5257 w.close()
5258 readers.append(r)
5259 procs.append(p)
5260 self.addCleanup(p.join)
5261
5262 while readers:
5263 for r in wait(readers):
5264 try:
5265 msg = r.recv()
5266 except EOFError:
5267 readers.remove(r)
5268 r.close()
5269 else:
5270 messages.append(msg)
5271
5272 messages.sort()
5273 expected = sorted((i, p.pid) for i in range(10) for p in procs)
5274 self.assertEqual(messages, expected)
5275
5276 @classmethod
5277 def _child_test_wait_socket(cls, address, slow):

Callers 1

test_wait_slowMethod · 0.95

Calls 12

waitFunction · 0.90
sortedFunction · 0.85
PipeMethod · 0.80
addCleanupMethod · 0.80
ProcessMethod · 0.45
startMethod · 0.45
closeMethod · 0.45
appendMethod · 0.45
recvMethod · 0.45
removeMethod · 0.45
sortMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected