]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
#17395: wait for live children in test_multiprocessing.
authorEzio Melotti <ezio.melotti@gmail.com>
Mon, 11 Mar 2013 19:39:18 +0000 (21:39 +0200)
committerEzio Melotti <ezio.melotti@gmail.com>
Mon, 11 Mar 2013 19:39:18 +0000 (21:39 +0200)
Lib/test/test_multiprocessing.py

index 53c8c1fdb40fe3c49ef161802854598df25e9b6b..6cda4fa3c808e9843cc546d1d4ebdf12be430036 100644 (file)
@@ -2998,7 +2998,13 @@ class ManagerMixin(object):
 
     @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