mirror of
https://github.com/python/cpython.git
synced 2025-10-17 20:28:43 +00:00
bpo-34728: Fix asyncio tests to run under "-Werror" (GH-9661)
This commit is contained in:
parent
11c4eaa993
commit
9012a0fb4c
14 changed files with 192 additions and 206 deletions
|
@ -271,7 +271,7 @@ class EventLoopTestsMixin:
|
|||
|
||||
def test_run_until_complete(self):
|
||||
t0 = self.loop.time()
|
||||
self.loop.run_until_complete(asyncio.sleep(0.1, loop=self.loop))
|
||||
self.loop.run_until_complete(asyncio.sleep(0.1))
|
||||
t1 = self.loop.time()
|
||||
self.assertTrue(0.08 <= t1-t0 <= 0.8, t1-t0)
|
||||
|
||||
|
@ -279,7 +279,7 @@ class EventLoopTestsMixin:
|
|||
|
||||
async def cb():
|
||||
self.loop.stop()
|
||||
await asyncio.sleep(0.1, loop=self.loop)
|
||||
await asyncio.sleep(0.1)
|
||||
task = cb()
|
||||
self.assertRaises(RuntimeError,
|
||||
self.loop.run_until_complete, task)
|
||||
|
@ -1757,11 +1757,11 @@ class EventLoopTestsMixin:
|
|||
|
||||
async def wait():
|
||||
loop = self.loop
|
||||
await asyncio.sleep(1e-2, loop=loop)
|
||||
await asyncio.sleep(1e-4, loop=loop)
|
||||
await asyncio.sleep(1e-6, loop=loop)
|
||||
await asyncio.sleep(1e-8, loop=loop)
|
||||
await asyncio.sleep(1e-10, loop=loop)
|
||||
await asyncio.sleep(1e-2)
|
||||
await asyncio.sleep(1e-4)
|
||||
await asyncio.sleep(1e-6)
|
||||
await asyncio.sleep(1e-8)
|
||||
await asyncio.sleep(1e-10)
|
||||
|
||||
self.loop.run_until_complete(wait())
|
||||
# The ideal number of call is 12, but on some platforms, the selector
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue