From: Serhiy Storchaka Date: Thu, 23 Apr 2015 08:35:43 +0000 (+0300) Subject: Issue #23713: Fixed fragility of test_imap_unordered_handle_iterable_exception. X-Git-Tag: v2.7.10rc1~23 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=89c3b8e480146b260006097201f0627fa23e4b57;p=python Issue #23713: Fixed fragility of test_imap_unordered_handle_iterable_exception. Patch by Davin Potts. --- diff --git a/Lib/test/test_multiprocessing.py b/Lib/test/test_multiprocessing.py index 681529ff7d..c66727cf3a 100644 --- a/Lib/test/test_multiprocessing.py +++ b/Lib/test/test_multiprocessing.py @@ -1219,17 +1219,23 @@ class _TestPool(BaseTestCase): it = self.pool.imap_unordered(sqr, exception_throwing_generator(10, 3), 1) + expected_values = map(sqr, range(10)) with self.assertRaises(SayWhenError): # imap_unordered makes it difficult to anticipate the SayWhenError for i in range(10): - self.assertEqual(next(it), i*i) + value = next(it) + self.assertIn(value, expected_values) + expected_values.remove(value) it = self.pool.imap_unordered(sqr, exception_throwing_generator(20, 7), 2) + expected_values = map(sqr, range(20)) with self.assertRaises(SayWhenError): for i in range(20): - self.assertEqual(next(it), i*i) + value = next(it) + self.assertIn(value, expected_values) + expected_values.remove(value) def test_make_pool(self): self.assertRaises(ValueError, multiprocessing.Pool, -1)