[Python-checkins] bpo-33735: Fix test_multiprocessing random failure (GH-8059)
Miss Islington (bot)
webhook-mailer at python.org
Tue Jul 3 07:51:04 EDT 2018
https://github.com/python/cpython/commit/3bd9d3b934eb8b27553f19a7ab1c97f95745c68f
commit: 3bd9d3b934eb8b27553f19a7ab1c97f95745c68f
branch: 3.6
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2018-07-03T04:51:00-07:00
summary:
bpo-33735: Fix test_multiprocessing random failure (GH-8059)
When hunting memory leaks using -R 3:3, test_imap_unordered() of
test_multiprocessing leaks randomly a few memory blocks. It is a
false alarm: when testing using -R 3:20 for example, no leak is
detected.
Modify test_imap_unordered() to be closer to test_imap():
* Only test 10 numbers instead of 1000: it's a pool of 4 processes, so
10 is enough to test at least one number per process
* Use chunksize=100 instead of chunksize=53 to mimick test_imap()
(cherry picked from commit 23401fb960bb94e6ea62d2999527968d53d3fc65)
Co-authored-by: Victor Stinner <vstinner at redhat.com>
files:
M Lib/test/_test_multiprocessing.py
diff --git a/Lib/test/_test_multiprocessing.py b/Lib/test/_test_multiprocessing.py
index dbca2d36f191..cbac335087c0 100644
--- a/Lib/test/_test_multiprocessing.py
+++ b/Lib/test/_test_multiprocessing.py
@@ -2085,10 +2085,10 @@ def test_imap_handle_iterable_exception(self):
self.assertRaises(SayWhenError, it.__next__)
def test_imap_unordered(self):
- it = self.pool.imap_unordered(sqr, list(range(1000)))
- self.assertEqual(sorted(it), list(map(sqr, list(range(1000)))))
+ it = self.pool.imap_unordered(sqr, list(range(10)))
+ self.assertEqual(sorted(it), list(map(sqr, list(range(10)))))
- it = self.pool.imap_unordered(sqr, list(range(1000)), chunksize=53)
+ it = self.pool.imap_unordered(sqr, list(range(1000)), chunksize=100)
self.assertEqual(sorted(it), list(map(sqr, list(range(1000)))))
def test_imap_unordered_handle_iterable_exception(self):
More information about the Python-checkins
mailing list