diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2023-09-26 00:34:00 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-26 00:34:00 (GMT) |
commit | 95e616aee099949a3707ec487dfc87b1eae65876 (patch) | |
tree | 9aac7064f7c73d338ba81d7ac5c88faf2798fd1f | |
parent | 358282e9655a4baf09aa876531fa56f3b5810ddf (diff) | |
download | cpython-95e616aee099949a3707ec487dfc87b1eae65876.zip cpython-95e616aee099949a3707ec487dfc87b1eae65876.tar.gz cpython-95e616aee099949a3707ec487dfc87b1eae65876.tar.bz2 |
[3.11] gh-109401: Fix threading barrier test_default_timeout() (GH-109875) (#109877)
gh-109401: Fix threading barrier test_default_timeout() (GH-109875)
Increase timeouts. Barrier default timeout should be long enough to
spawn 4 threads on a slow CI.
(cherry picked from commit e5186c3de4194de3ea8c80edb182d786f5e20944)
Co-authored-by: Victor Stinner <vstinner@python.org>
-rw-r--r-- | Lib/test/lock_tests.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/Lib/test/lock_tests.py b/Lib/test/lock_tests.py index f16c7ed..bd6e95c 100644 --- a/Lib/test/lock_tests.py +++ b/Lib/test/lock_tests.py @@ -1015,13 +1015,15 @@ class BarrierTests(BaseTestCase): """ Test the barrier's default timeout """ - # create a barrier with a low default timeout - barrier = self.barriertype(self.N, timeout=0.3) + # gh-109401: Barrier timeout should be long enough + # to create 4 threads on a slow CI. + timeout = 1.0 + barrier = self.barriertype(self.N, timeout=timeout) def f(): i = barrier.wait() if i == self.N // 2: - # One thread is later than the default timeout of 0.3s. - time.sleep(1.0) + # One thread is later than the default timeout. + time.sleep(timeout * 2) self.assertRaises(threading.BrokenBarrierError, barrier.wait) self.run_threads(f) |