diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2024-03-06 22:13:49 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-06 22:13:49 (GMT) |
commit | 01505953f20f66b5b030d47379e3da448dff599b (patch) | |
tree | a5afb14ed0d3a99f8ff949391bdc4014fa7c3cb8 /Lib | |
parent | 0a01ed6c2a116bd3e174fce33c21d84d650de569 (diff) | |
download | cpython-01505953f20f66b5b030d47379e3da448dff599b.zip cpython-01505953f20f66b5b030d47379e3da448dff599b.tar.gz cpython-01505953f20f66b5b030d47379e3da448dff599b.tar.bz2 |
[3.12] gh-88118: Fix some test_multiprocessing flakiness. (GH-116434) (GH-116440)
Fix some test_multiprocessing flakiness.
Potentially introduced by https://github.com/python/cpython/pull/25845
not joining that thread likely leads to recently observed "environment
changed" logically passing but overall failing tests seen on some
buildbots similar to:
```
1 test altered the execution environment (env changed):
test.test_multiprocessing_fork.test_processes
2 re-run tests:
test.test_multiprocessing_fork.test_processes
test.test_multiprocessing_forkserver.test_processes
```
(cherry picked from commit ea1803e608a7aaf9cf2c07e510d8540d46d3b9ad)
Co-authored-by: Gregory P. Smith <greg@krypto.org>
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/_test_multiprocessing.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/Lib/test/_test_multiprocessing.py b/Lib/test/_test_multiprocessing.py index 54ee93a..9e688ef 100644 --- a/Lib/test/_test_multiprocessing.py +++ b/Lib/test/_test_multiprocessing.py @@ -3475,15 +3475,20 @@ class _TestListener(BaseTestCase): client = self.connection.Client(addr, authkey=authkey) client.send(1729) - key = b"" + key = b'' with self.connection.Listener(authkey=key) as listener: - threading.Thread(target=run, args=(listener.address, key)).start() - with listener.accept() as d: - self.assertEqual(d.recv(), 1729) + thread = threading.Thread(target=run, args=(listener.address, key)) + thread.start() + try: + with listener.accept() as d: + self.assertEqual(d.recv(), 1729) + finally: + thread.join() if self.TYPE == 'processes': - self.assertRaises(OSError, listener.accept) + with self.assertRaises(OSError): + listener.accept() @unittest.skipUnless(util.abstract_sockets_supported, "test needs abstract socket support") |