mirror of
https://github.com/python/cpython.git
synced 2025-08-11 04:19:06 +00:00
[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 ea1803e608
)
Co-authored-by: Gregory P. Smith <greg@krypto.org>
This commit is contained in:
parent
0a01ed6c2a
commit
01505953f2
1 changed files with 10 additions and 5 deletions
|
@ -3475,15 +3475,20 @@ class _TestListener(BaseTestCase):
|
||||||
client = self.connection.Client(addr, authkey=authkey)
|
client = self.connection.Client(addr, authkey=authkey)
|
||||||
client.send(1729)
|
client.send(1729)
|
||||||
|
|
||||||
key = b""
|
key = b''
|
||||||
|
|
||||||
with self.connection.Listener(authkey=key) as listener:
|
with self.connection.Listener(authkey=key) as listener:
|
||||||
threading.Thread(target=run, args=(listener.address, key)).start()
|
thread = threading.Thread(target=run, args=(listener.address, key))
|
||||||
with listener.accept() as d:
|
thread.start()
|
||||||
self.assertEqual(d.recv(), 1729)
|
try:
|
||||||
|
with listener.accept() as d:
|
||||||
|
self.assertEqual(d.recv(), 1729)
|
||||||
|
finally:
|
||||||
|
thread.join()
|
||||||
|
|
||||||
if self.TYPE == 'processes':
|
if self.TYPE == 'processes':
|
||||||
self.assertRaises(OSError, listener.accept)
|
with self.assertRaises(OSError):
|
||||||
|
listener.accept()
|
||||||
|
|
||||||
@unittest.skipUnless(util.abstract_sockets_supported,
|
@unittest.skipUnless(util.abstract_sockets_supported,
|
||||||
"test needs abstract socket support")
|
"test needs abstract socket support")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue