Skip to content

Commit

Permalink
[3.12] gh-109565: Fix concurrent.futures test_future_times_out() (GH-…
Browse files Browse the repository at this point in the history
…109949) (#109952)

gh-109565: Fix concurrent.futures test_future_times_out() (GH-109949)

as_completed() uses a timeout of 100 ms instead of 10 ms. Windows
monotonic clock resolution is around 15.6 ms.
(cherry picked from commit b1aebf1)

Co-authored-by: Victor Stinner <[email protected]>
  • Loading branch information
miss-islington and vstinner authored Oct 2, 2023
1 parent 1fc25a3 commit 73ec1e7
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 73ec1e7

Please sign in to comment.