[Python-checkins] cpython: #17395: wait for live children in test_multiprocessing.

ezio.melotti python-checkins at python.org
Mon Mar 11 20:39:35 CET 2013


http://hg.python.org/cpython/rev/2966e5a55396
changeset:   82608:2966e5a55396
user:        Ezio Melotti <ezio.melotti at gmail.com>
date:        Mon Mar 11 21:39:18 2013 +0200
summary:
  #17395: wait for live children in test_multiprocessing.

files:
  Lib/test/test_multiprocessing.py |  8 +++++++-
  1 files changed, 7 insertions(+), 1 deletions(-)


diff --git a/Lib/test/test_multiprocessing.py b/Lib/test/test_multiprocessing.py
--- a/Lib/test/test_multiprocessing.py
+++ b/Lib/test/test_multiprocessing.py
@@ -2998,7 +2998,13 @@
 
     @classmethod
     def tearDownClass(cls):
-        multiprocessing.active_children()  # discard dead process objs
+        # only the manager process should be returned by active_children()
+        # but this can take a bit on slow machines, so wait a few seconds
+        # if there are other children too (see #17395)
+        t = 0.01
+        while len(multiprocessing.active_children()) > 1 and t < 5:
+            time.sleep(t)
+            t *= 2
         gc.collect()                       # do garbage collection
         if cls.manager._number_of_objects() != 0:
             # This is not really an error since some tests do not

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list