bpo-39191: Fix RuntimeWarning in asyncio test (GH-17863)

https://bugs.python.org/issue39191
This commit is contained in:
Andrew Svetlov 2020-01-07 15:23:01 +02:00 committed by Miss Islington (bot)
parent ca94677a62
commit 10ac0cded2
2 changed files with 9 additions and 5 deletions

View file

@ -259,8 +259,12 @@ class EventLoopTestsMixin:
self.assertTrue(self.loop.is_running())
self.loop.run_until_complete(coro1())
self.assertRaises(
RuntimeError, self.loop.run_until_complete, coro2())
with self.assertWarnsRegex(
RuntimeWarning,
r"coroutine \S+ was never awaited"
):
self.assertRaises(
RuntimeError, self.loop.run_until_complete, coro2())
# Note: because of the default Windows timing granularity of
# 15.6 msec, we use fairly long sleep times here (~100 msec).