Skip to content

Commit

Permalink
gh-109565: Fix concurrent.futures test_future_times_out()
Browse files Browse the repository at this point in the history
as_completed() uses a timeout of 100 ms instead of 10 ms. Windows
monotonic clock resolution is around 15.6 ms.
  • Loading branch information
vstinner committed Sep 27, 2023
1 parent 0e28d0f commit bf4ab70
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Lib/test/test_concurrent_futures/test_as_completed.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,14 @@ def test_future_times_out(self):
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},
Expand Down

0 comments on commit bf4ab70

Please sign in to comment.