[Python-checkins] r78654 - in python/branches/py3k: Lib/test/test_multiprocessing.py

florent.xicluna python-checkins at python.org
Thu Mar 4 17:10:11 CET 2010


Author: florent.xicluna
Date: Thu Mar  4 17:10:10 2010
New Revision: 78654

Log:
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
........


Modified:
   python/branches/py3k/   (props changed)
   python/branches/py3k/Lib/test/test_multiprocessing.py

Modified: python/branches/py3k/Lib/test/test_multiprocessing.py
==============================================================================
--- python/branches/py3k/Lib/test/test_multiprocessing.py	(original)
+++ python/branches/py3k/Lib/test/test_multiprocessing.py	Thu Mar  4 17:10:10 2010
@@ -1071,8 +1071,16 @@
             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()


More information about the Python-checkins mailing list