Skip to content

Commit 3ad8dec

Browse files
authored
bpo-33716, test_concurrent_futures: increase timeout (GH-7828)
Increase the timeout from 1 min to 5 min. Replace also time.time() with time.monotonic() for timeouts.
1 parent 940ae60 commit 3ad8dec

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Lib/test/test_concurrent_futures.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ class ExecutorMixin:
109109
def setUp(self):
110110
super().setUp()
111111

112-
self.t1 = time.time()
112+
self.t1 = time.monotonic()
113113
if hasattr(self, "ctx"):
114114
self.executor = self.executor_type(
115115
max_workers=self.worker_count,
@@ -125,10 +125,10 @@ def tearDown(self):
125125
self.executor.shutdown(wait=True)
126126
self.executor = None
127127

128-
dt = time.time() - self.t1
128+
dt = time.monotonic() - self.t1
129129
if test.support.verbose:
130130
print("%.2fs" % dt, end=' ')
131-
self.assertLess(dt, 60, "synchronization issue: test lasted too long")
131+
self.assertLess(dt, 300, "synchronization issue: test lasted too long")
132132

133133
super().tearDown()
134134

@@ -240,9 +240,9 @@ def test_initializer(self):
240240
with self.assertRaises(BrokenExecutor):
241241
future.result()
242242
# At some point, the executor should break
243-
t1 = time.time()
243+
t1 = time.monotonic()
244244
while not self.executor._broken:
245-
if time.time() - t1 > 5:
245+
if time.monotonic() - t1 > 5:
246246
self.fail("executor not broken after 5 s.")
247247
time.sleep(0.01)
248248
# ... and from this point submit() is guaranteed to fail

0 commit comments

Comments
 (0)