From: Victor Stinner Date: Thu, 23 Apr 2020 22:20:00 +0000 (+0200) Subject: bpo-39932: Fix multiprocessing test_heap() (GH-19690) X-Git-Tag: v3.7.8rc1~78 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=857d573257ab150d6bea666354312a5fd284b171;p=thirdparty%2FPython%2Fcpython.git 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. --- diff --git a/Lib/test/_test_multiprocessing.py b/Lib/test/_test_multiprocessing.py index 30ea23da6949..a889ad3ae391 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 000000000000..c50be579834a --- /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.