bpo-34728: Fix asyncio tests to run under "-Werror" (GH-9661)

This commit is contained in:
Yury Selivanov 2018-10-02 13:53:06 -04:00 committed by GitHub
parent 11c4eaa993
commit 9012a0fb4c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 192 additions and 206 deletions

View file

@ -81,13 +81,13 @@ class LockTests(test_utils.TestCase):
@asyncio.coroutine
def test(lock):
yield from asyncio.sleep(0.01, loop=loop)
yield from asyncio.sleep(0.01)
self.assertFalse(lock.locked())
with self.assertWarns(DeprecationWarning):
with (yield from lock) as _lock:
self.assertIs(_lock, None)
self.assertTrue(lock.locked())
yield from asyncio.sleep(0.01, loop=loop)
yield from asyncio.sleep(0.01)
self.assertTrue(lock.locked())
self.assertFalse(lock.locked())
@ -819,8 +819,7 @@ class ConditionTests(test_utils.TestCase):
condition = asyncio.Condition(loop=loop)
async with condition:
with self.assertRaises(asyncio.TimeoutError):
await asyncio.wait_for(condition.wait(), timeout=0.5,
loop=loop)
await asyncio.wait_for(condition.wait(), timeout=0.5)
loop.run_until_complete(task_timeout())