[Python-checkins] bpo-39932: Fix multiprocessing test_heap() (GH-19690)
Victor Stinner
webhook-mailer at python.org
Thu Apr 23 18:20:05 EDT 2020
https://github.com/python/cpython/commit/857d573257ab150d6bea666354312a5fd284b171
commit: 857d573257ab150d6bea666354312a5fd284b171
branch: 3.7
author: Victor Stinner <vstinner at python.org>
committer: GitHub <noreply at github.com>
date: 2020-04-24T00:20:00+02:00
summary:
bpo-39932: Fix multiprocessing test_heap() (GH-19690)
bpo-32759, bpo-39932: Fix multiprocessing test_heap():
a new Heap object is now created for each test run.
Partial backport of commit e4679cd644aa19f9d9df9beb1326625cf2b02c15
by Antoine Pitrou.
files:
A Misc/NEWS.d/next/Tests/2020-04-23-23-46-08.bpo-39932.6G8rRN.rst
M Lib/test/_test_multiprocessing.py
diff --git a/Lib/test/_test_multiprocessing.py b/Lib/test/_test_multiprocessing.py
index 30ea23da69499..a889ad3ae3918 100644
--- a/Lib/test/_test_multiprocessing.py
+++ b/Lib/test/_test_multiprocessing.py
@@ -3424,6 +3424,16 @@ class _TestHeap(BaseTestCase):
ALLOWED_TYPES = ('processes',)
+ def setUp(self):
+ super().setUp()
+ # Make pristine heap for these tests
+ self.old_heap = multiprocessing.heap.BufferWrapper._heap
+ multiprocessing.heap.BufferWrapper._heap = multiprocessing.heap.Heap()
+
+ def tearDown(self):
+ multiprocessing.heap.BufferWrapper._heap = self.old_heap
+ super().tearDown()
+
def test_heap(self):
iterations = 5000
maxblocks = 50
diff --git a/Misc/NEWS.d/next/Tests/2020-04-23-23-46-08.bpo-39932.6G8rRN.rst b/Misc/NEWS.d/next/Tests/2020-04-23-23-46-08.bpo-39932.6G8rRN.rst
new file mode 100644
index 0000000000000..c50be579834ab
--- /dev/null
+++ b/Misc/NEWS.d/next/Tests/2020-04-23-23-46-08.bpo-39932.6G8rRN.rst
@@ -0,0 +1,2 @@
+Fix multiprocessing test_heap(): a new Heap object is now created for each test
+run.
More information about the Python-checkins
mailing list