mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
gh-109565: Fix concurrent.futures test_future_times_out() (#109949)
as_completed() uses a timeout of 100 ms instead of 10 ms. Windows monotonic clock resolution is around 15.6 ms.
This commit is contained in:
parent
1512d6c6ee
commit
b1aebf1e65
1 changed files with 5 additions and 2 deletions
|
@ -42,11 +42,14 @@ class AsCompletedTests:
|
|||
EXCEPTION_FUTURE,
|
||||
SUCCESSFUL_FUTURE}
|
||||
|
||||
for timeout in (0, 0.01):
|
||||
# Windows clock resolution is around 15.6 ms
|
||||
short_timeout = 0.100
|
||||
for timeout in (0, short_timeout):
|
||||
with self.subTest(timeout):
|
||||
|
||||
future = self.executor.submit(time.sleep, 0.1)
|
||||
completed_futures = set()
|
||||
future = self.executor.submit(time.sleep, short_timeout * 10)
|
||||
|
||||
try:
|
||||
for f in futures.as_completed(
|
||||
already_completed | {future},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue