aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test/test_importlib/test_locks.py
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2023-09-29 14:21:18 +0200
committerGitHub <noreply@github.com>2023-09-29 12:21:18 +0000
commit743e3572ee940a6cf88fd518e5f4a447905ba5eb (patch)
tree870c89c862bb7ccc96db199468791a96ea7f7484 /Lib/test/test_importlib/test_locks.py
parent501939c9c1433c5b95ca19ae752e5881149f61b9 (diff)
downloadcpython-743e3572ee940a6cf88fd518e5f4a447905ba5eb.tar.gz
cpython-743e3572ee940a6cf88fd518e5f4a447905ba5eb.zip
gh-109974: Fix more threading lock_tests race conditions (#110089)
* Add context manager on Bunch class. * Bunch now catchs exceptions on executed functions and re-raise them at __exit__() as an ExceptionGroup. * Rewrite BarrierProxy.test_default_timeout(). Use a single thread. Only check that barrier.wait() blocks for at least default timeout seconds. * test_with(): inline _with() function.
Diffstat (limited to 'Lib/test/test_importlib/test_locks.py')
-rw-r--r--Lib/test/test_importlib/test_locks.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/test/test_importlib/test_locks.py b/Lib/test/test_importlib/test_locks.py
index 7091c36aaaf..befac5d62b0 100644
--- a/Lib/test/test_importlib/test_locks.py
+++ b/Lib/test/test_importlib/test_locks.py
@@ -93,7 +93,8 @@ class DeadlockAvoidanceTests:
b.release()
if ra:
a.release()
- lock_tests.Bunch(f, NTHREADS).wait_for_finished()
+ with lock_tests.Bunch(f, NTHREADS):
+ pass
self.assertEqual(len(results), NTHREADS)
return results