summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorCharles-François Natali <neologix@free.fr>2012-05-02 18:51:59 (GMT)
committerCharles-François Natali <neologix@free.fr>2012-05-02 18:51:59 (GMT)
commit598b2f6bd02b1aa118263538fa9e33769da553df (patch)
tree8dcd32568abfdd97a43f322b7f053a8c9cabfef4 /Lib
parent360b3c21f5df26569be8b6431c859416d0f8f333 (diff)
parent225cb8d077b9d34ec20480aad3cbd9018798546f (diff)
downloadcpython-598b2f6bd02b1aa118263538fa9e33769da553df.zip
cpython-598b2f6bd02b1aa118263538fa9e33769da553df.tar.gz
cpython-598b2f6bd02b1aa118263538fa9e33769da553df.tar.bz2
Merge.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_multiprocessing.py21
1 files changed, 13 insertions, 8 deletions
diff --git a/Lib/test/test_multiprocessing.py b/Lib/test/test_multiprocessing.py
index c87b967..792db25 100644
--- a/Lib/test/test_multiprocessing.py
+++ b/Lib/test/test_multiprocessing.py
@@ -2555,6 +2555,8 @@ def _afunc(x):
def pool_in_process():
pool = multiprocessing.Pool(processes=4)
x = pool.map(_afunc, [1, 2, 3, 4, 5, 6, 7])
+ pool.close()
+ pool.join()
class _file_like(object):
def __init__(self, delegate):
@@ -2808,14 +2810,17 @@ def test_main(run=None):
loadTestsFromTestCase = unittest.defaultTestLoader.loadTestsFromTestCase
suite = unittest.TestSuite(loadTestsFromTestCase(tc) for tc in testcases)
- run(suite)
-
- ThreadsMixin.pool.terminate()
- ProcessesMixin.pool.terminate()
- ManagerMixin.pool.terminate()
- ManagerMixin.manager.shutdown()
-
- del ProcessesMixin.pool, ThreadsMixin.pool, ManagerMixin.pool
+ try:
+ run(suite)
+ finally:
+ ThreadsMixin.pool.terminate()
+ ProcessesMixin.pool.terminate()
+ ManagerMixin.pool.terminate()
+ ManagerMixin.pool.join()
+ ManagerMixin.manager.shutdown()
+ ThreadsMixin.pool.join()
+ ProcessesMixin.pool.join()
+ del ProcessesMixin.pool, ThreadsMixin.pool, ManagerMixin.pool
def main():
test_main(unittest.TextTestRunner(verbosity=2).run)