]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.11] gh-109706: Fix multiprocessing test_nested_startmethod() (GH-109707) (#109763)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Fri, 22 Sep 2023 22:09:46 +0000 (15:09 -0700)
committerGitHub <noreply@github.com>
Fri, 22 Sep 2023 22:09:46 +0000 (22:09 +0000)
gh-109706: Fix multiprocessing test_nested_startmethod() (GH-109707)

Don't check order, queue items can be written in any order.
(cherry picked from commit b03a791497ff4b3c42805e06c73d08ac34087402)

Co-authored-by: Victor Stinner <vstinner@python.org>
Lib/test/_test_multiprocessing.py

index ac0ed397684f421f6aa849cad727145fb368e7e7..e83c4416cb05a3dbc56969a965abb3e987528a8a 100644 (file)
@@ -5396,7 +5396,9 @@ class TestStartMethod(unittest.TestCase):
         while not queue.empty():
             results.append(queue.get())
 
-        self.assertEqual(results, [2, 1])
+        # gh-109706: queue.put(1) can write into the queue before queue.put(2),
+        # there is no synchronization in the test.
+        self.assertSetEqual(set(results), set([2, 1]))
 
 
 @unittest.skipIf(sys.platform == "win32",