diff options
author | Victor Stinner <vstinner@python.org> | 2022-06-15 11:42:10 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-15 11:42:10 +0200 |
commit | 7e9eaad864349d2cfd4c9ffc4453aba03b2cbc16 (patch) | |
tree | 7bc4498a4c5ad027208a714ff9281d2f4639e301 /Lib/test/test_concurrent_futures.py | |
parent | 4e9fa71d7e8e2f322f0b81b315ddc921f57384c0 (diff) | |
download | cpython-7e9eaad864349d2cfd4c9ffc4453aba03b2cbc16.tar.gz cpython-7e9eaad864349d2cfd4c9ffc4453aba03b2cbc16.zip |
Add test.support.busy_retry() (#93770)
Add busy_retry() and sleeping_retry() functions to test.support.
Diffstat (limited to 'Lib/test/test_concurrent_futures.py')
-rw-r--r-- | Lib/test/test_concurrent_futures.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Lib/test/test_concurrent_futures.py b/Lib/test/test_concurrent_futures.py index 6f3b4609232..c12165366bb 100644 --- a/Lib/test/test_concurrent_futures.py +++ b/Lib/test/test_concurrent_futures.py @@ -256,12 +256,12 @@ class FailingInitializerMixin(ExecutorMixin): else: with self.assertRaises(BrokenExecutor): future.result() + # At some point, the executor should break - t1 = time.monotonic() - while not self.executor._broken: - if time.monotonic() - t1 > 5: - self.fail("executor not broken after 5 s.") - time.sleep(0.01) + for _ in support.sleeping_retry(5, "executor not broken"): + if self.executor._broken: + break + # ... and from this point submit() is guaranteed to fail with self.assertRaises(BrokenExecutor): self.executor.submit(get_init_status) |