mirror of
https://github.com/python/cpython.git
synced 2026-04-26 05:40:58 +00:00
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 23401fb960)
Co-authored-by: Victor Stinner <vstinner@redhat.com>
This commit is contained in:
parent
4d02ad856f
commit
42b2f84a85
1 changed files with 3 additions and 3 deletions
|
|
@ -2351,10 +2351,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):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue