mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
gh-110088, gh-109878: Fix test_asyncio timeouts (#110092)
Fix test_asyncio timeouts: don't measure the maximum duration, a test
should not measure a CI performance. Only measure the minimum
duration when a task has a timeout or delay. Add CLOCK_RES to
test_asyncio.utils.
(cherry picked from commit db0a258e79
)
This commit is contained in:
parent
d81bcc2327
commit
184ce1414b
7 changed files with 19 additions and 54 deletions
|
@ -273,7 +273,7 @@ class BaseEventLoopTests(test_utils.TestCase):
|
|||
self.loop.stop()
|
||||
|
||||
self.loop._process_events = mock.Mock()
|
||||
delay = 0.1
|
||||
delay = 0.100
|
||||
|
||||
when = self.loop.time() + delay
|
||||
self.loop.call_at(when, cb)
|
||||
|
@ -282,10 +282,7 @@ class BaseEventLoopTests(test_utils.TestCase):
|
|||
dt = self.loop.time() - t0
|
||||
|
||||
# 50 ms: maximum granularity of the event loop
|
||||
self.assertGreaterEqual(dt, delay - 0.050, dt)
|
||||
# tolerate a difference of +800 ms because some Python buildbots
|
||||
# are really slow
|
||||
self.assertLessEqual(dt, 0.9, dt)
|
||||
self.assertGreaterEqual(dt, delay - test_utils.CLOCK_RES)
|
||||
with self.assertRaises(TypeError, msg="when cannot be None"):
|
||||
self.loop.call_at(None, cb)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue