diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2015-04-23 08:36:40 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2015-04-23 08:36:40 (GMT) |
commit | 84de1bf2818308b8d1fd3d687ae3b7199f4462f2 (patch) | |
tree | 6556cfd1fcfea7f116cf2d950b4c9dce60cff92b | |
parent | f28d54d3b96e411be7ea3279c901fd6edc18ee4d (diff) | |
parent | 71f73ca7a9098c678d6bf3073b02228783100665 (diff) | |
download | cpython-84de1bf2818308b8d1fd3d687ae3b7199f4462f2.zip cpython-84de1bf2818308b8d1fd3d687ae3b7199f4462f2.tar.gz cpython-84de1bf2818308b8d1fd3d687ae3b7199f4462f2.tar.bz2 |
Issue #23713: Fixed fragility of test_imap_unordered_handle_iterable_exception.
Patch by Davin Potts.
-rw-r--r-- | Lib/test/_test_multiprocessing.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Lib/test/_test_multiprocessing.py b/Lib/test/_test_multiprocessing.py index 6cff4fc..b66cb40 100644 --- a/Lib/test/_test_multiprocessing.py +++ b/Lib/test/_test_multiprocessing.py @@ -1799,17 +1799,23 @@ class _TestPool(BaseTestCase): it = self.pool.imap_unordered(sqr, exception_throwing_generator(10, 3), 1) + expected_values = list(map(sqr, list(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 = list(map(sqr, list(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) |