From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Mon, 2 Oct 2023 15:40:16 +0000 (-0700) Subject: [3.12] gh-109565: Fix concurrent.futures test_future_times_out() (GH-109949) (#109952) X-Git-Tag: v3.12.1~424 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=73ec1e7c219ea116521bd1024d23b352625966f0;p=thirdparty%2FPython%2Fcpython.git [3.12] gh-109565: Fix concurrent.futures test_future_times_out() (GH-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 b1aebf1e6576680d606068d17e2208259573e061) Co-authored-by: Victor Stinner --- diff --git a/Lib/test/test_concurrent_futures/test_as_completed.py b/Lib/test/test_concurrent_futures/test_as_completed.py index 2b3bec8cafbc..c90b0021d85f 100644 --- a/Lib/test/test_concurrent_futures/test_as_completed.py +++ b/Lib/test/test_concurrent_futures/test_as_completed.py @@ -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},