summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorent Xicluna <florent.xicluna@gmail.com>2010-03-04 16:10:10 (GMT)
committerFlorent Xicluna <florent.xicluna@gmail.com>2010-03-04 16:10:10 (GMT)
commitfb190f64b2658c860b4da5d0f6d98547718b9f12 (patch)
treec0fba1631542d05ec7e1329b32fbb96f48809679
parent931bb02d96d7f91fa883027f6e107cc0b1dbb6d5 (diff)
downloadcpython-fb190f64b2658c860b4da5d0f6d98547718b9f12.zip
cpython-fb190f64b2658c860b4da5d0f6d98547718b9f12.tar.gz
cpython-fb190f64b2658c860b4da5d0f6d98547718b9f12.tar.bz2
Merged revisions 78653 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r78653 | florent.xicluna | 2010-03-04 16:58:54 +0100 (jeu, 04 mar 2010) | 2 lines #7805: wait until all workers are started before collecting their PIDs ........
-rw-r--r--Lib/test/test_multiprocessing.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/Lib/test/test_multiprocessing.py b/Lib/test/test_multiprocessing.py
index be923bd..7fcbdc32 100644
--- a/Lib/test/test_multiprocessing.py
+++ b/Lib/test/test_multiprocessing.py
@@ -1071,8 +1071,16 @@ class _TestPoolWorkerLifetime(BaseTestCase):
self.assertEqual(res.get(), sqr(j))
# Refill the pool
p._repopulate_pool()
- # Finally, check that the worker pids have changed
+ # Wait until all workers are alive
+ countdown = 5
+ while countdown and not all(w.is_alive() for w in p._pool):
+ countdown -= 1
+ time.sleep(DELTA)
finalworkerpids = [w.pid for w in p._pool]
+ # All pids should be assigned. See issue #7805.
+ self.assertNotIn(None, origworkerpids)
+ self.assertNotIn(None, finalworkerpids)
+ # Finally, check that the worker pids have changed
self.assertNotEqual(sorted(origworkerpids), sorted(finalworkerpids))
p.close()
p.join()