#
#
+# Timeout to wait until a process completes
+TIMEOUT = 30.0 # seconds
+
def latin(s):
return s.encode('latin')
queue.join_thread()
-def join_process(process, timeout):
+def join_process(process):
# Since multiprocessing.Process has the same API than threading.Thread
# (join() and is_alive(), the support function can be reused
- support.join_thread(process, timeout)
+ support.join_thread(process, timeout=TIMEOUT)
#
for p in procs:
p.start()
for p in procs:
- join_process(p, timeout=10)
+ join_process(p)
for p in procs:
self.assertEqual(p.exitcode, 0)
for p in procs:
p.terminate()
for p in procs:
- join_process(p, timeout=10)
+ join_process(p)
if os.name != 'nt':
for p in procs:
self.assertEqual(p.exitcode, -signal.SIGTERM)
p = self.Process(target=self._test_sys_exit, args=(reason, testfn))
p.daemon = True
p.start()
- join_process(p, timeout=5)
+ join_process(p)
self.assertEqual(p.exitcode, 1)
with open(testfn, 'r') as f:
p = self.Process(target=sys.exit, args=(reason,))
p.daemon = True
p.start()
- join_process(p, timeout=5)
+ join_process(p)
self.assertEqual(p.exitcode, reason)
#
state.value += 1
cond.notify()
- join_process(p, timeout=5)
+ join_process(p)
self.assertEqual(p.exitcode, 0)
@classmethod
args=(cond, state, success, sem))
p.daemon = True
p.start()
- self.assertTrue(sem.acquire(timeout=10))
+ self.assertTrue(sem.acquire(timeout=TIMEOUT))
# Only increment 3 times, so state == 4 is never reached.
for i in range(3):
state.value += 1
cond.notify()
- join_process(p, timeout=5)
+ join_process(p)
self.assertTrue(success.value)
@classmethod
@classmethod
def tearDownClass(cls):
from multiprocessing import resource_sharer
- resource_sharer.stop(timeout=5)
+ resource_sharer.stop(timeout=TIMEOUT)
@classmethod
def _listener(cls, conn, families):
self.assertEqual(conn.recv(), 456)
conn.close()
l.close()
- join_process(p, timeout=10)
+ join_process(p)
finally:
socket.setdefaulttimeout(old_timeout)
p = multiprocessing.Process(target=cls.child, args=(n-1, conn))
p.start()
conn.close()
- join_process(p, timeout=5)
+ join_process(p)
else:
conn.send(len(util._afterfork_registry))
conn.close()
p.start()
w.close()
new_size = r.recv()
- join_process(p, timeout=5)
+ join_process(p)
self.assertLessEqual(new_size, old_size)
#
p.start()
writer.close()
e = reader.recv()
- join_process(p, timeout=5)
+ join_process(p)
finally:
self.close(fd)
writer.close()