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.
(cherry picked from commit 3ad8decd76)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
This commit is contained in:
Miss Islington (bot) 2018-07-12 02:05:49 -07:00 committed by GitHub
parent 9beed0c36f
commit b89776fb1b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 5 deletions

View File

@ -109,7 +109,7 @@ class ExecutorMixin:
def setUp(self): def setUp(self):
super().setUp() super().setUp()
self.t1 = time.time() self.t1 = time.monotonic()
if hasattr(self, "ctx"): if hasattr(self, "ctx"):
self.executor = self.executor_type( self.executor = self.executor_type(
max_workers=self.worker_count, max_workers=self.worker_count,
@ -125,10 +125,10 @@ class ExecutorMixin:
self.executor.shutdown(wait=True) self.executor.shutdown(wait=True)
self.executor = None self.executor = None
dt = time.time() - self.t1 dt = time.monotonic() - self.t1
if test.support.verbose: if test.support.verbose:
print("%.2fs" % dt, end=' ') print("%.2fs" % dt, end=' ')
self.assertLess(dt, 60, "synchronization issue: test lasted too long") self.assertLess(dt, 300, "synchronization issue: test lasted too long")
super().tearDown() super().tearDown()
@ -240,9 +240,9 @@ class FailingInitializerMixin(ExecutorMixin):
with self.assertRaises(BrokenExecutor): with self.assertRaises(BrokenExecutor):
future.result() future.result()
# At some point, the executor should break # At some point, the executor should break
t1 = time.time() t1 = time.monotonic()
while not self.executor._broken: while not self.executor._broken:
if time.time() - t1 > 5: if time.monotonic() - t1 > 5:
self.fail("executor not broken after 5 s.") self.fail("executor not broken after 5 s.")
time.sleep(0.01) time.sleep(0.01)
# ... and from this point submit() is guaranteed to fail # ... and from this point submit() is guaranteed to fail