summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_asyncio/test_tasks.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_asyncio/test_tasks.py')
-rw-r--r--Lib/test/test_asyncio/test_tasks.py21
1 files changed, 13 insertions, 8 deletions
diff --git a/Lib/test/test_asyncio/test_tasks.py b/Lib/test/test_asyncio/test_tasks.py
index d2d7803..5e14b62 100644
--- a/Lib/test/test_asyncio/test_tasks.py
+++ b/Lib/test/test_asyncio/test_tasks.py
@@ -1606,8 +1606,9 @@ class BaseTaskTests:
for f in asyncio.as_completed([b, c, a], loop=loop):
values.append(await f)
return values
- with self.assertWarns(DeprecationWarning):
+ with self.assertWarns(DeprecationWarning) as w:
res = loop.run_until_complete(self.new_task(loop, foo()))
+ self.assertEqual(w.warnings[0].filename, __file__)
self.assertAlmostEqual(0.15, loop.time())
self.assertTrue('a' in res[:2])
self.assertTrue('b' in res[:2])
@@ -3348,7 +3349,8 @@ class FutureGatherTests(GatherTestsBase, test_utils.TestCase):
with self.assertRaises(ValueError):
asyncio.gather(fut1, fut2)
with self.assertRaises(ValueError):
- asyncio.gather(fut1, loop=self.other_loop)
+ with self.assertWarns(DeprecationWarning):
+ asyncio.gather(fut1, loop=self.other_loop)
def test_constructor_homogenous_futures(self):
children = [self.other_loop.create_future() for i in range(3)]
@@ -3356,7 +3358,8 @@ class FutureGatherTests(GatherTestsBase, test_utils.TestCase):
self.assertIs(fut._loop, self.other_loop)
self._run_loop(self.other_loop)
self.assertFalse(fut.done())
- fut = asyncio.gather(*children, loop=self.other_loop)
+ with self.assertWarns(DeprecationWarning):
+ fut = asyncio.gather(*children, loop=self.other_loop)
self.assertIs(fut._loop, self.other_loop)
self._run_loop(self.other_loop)
self.assertFalse(fut.done())
@@ -3429,7 +3432,8 @@ class CoroutineGatherTests(GatherTestsBase, test_utils.TestCase):
self.set_event_loop(self.other_loop, cleanup=False)
gen3 = coro()
gen4 = coro()
- fut2 = asyncio.gather(gen3, gen4, loop=self.other_loop)
+ with self.assertWarns(DeprecationWarning):
+ fut2 = asyncio.gather(gen3, gen4, loop=self.other_loop)
self.assertIs(fut2._loop, self.other_loop)
self.other_loop.run_until_complete(fut2)
@@ -3439,7 +3443,8 @@ class CoroutineGatherTests(GatherTestsBase, test_utils.TestCase):
def coro(s):
return s
c = coro('abc')
- fut = asyncio.gather(c, c, coro('def'), c, loop=self.one_loop)
+ with self.assertWarns(DeprecationWarning):
+ fut = asyncio.gather(c, c, coro('def'), c, loop=self.one_loop)
self._run_loop(self.one_loop)
self.assertEqual(fut.result(), ['abc', 'abc', 'def', 'abc'])
@@ -3459,7 +3464,7 @@ class CoroutineGatherTests(GatherTestsBase, test_utils.TestCase):
async def outer():
nonlocal proof, gatherer
- gatherer = asyncio.gather(child1, child2, loop=self.one_loop)
+ gatherer = asyncio.gather(child1, child2)
await gatherer
proof += 100
@@ -3486,7 +3491,7 @@ class CoroutineGatherTests(GatherTestsBase, test_utils.TestCase):
b = self.one_loop.create_future()
async def outer():
- await asyncio.gather(inner(a), inner(b), loop=self.one_loop)
+ await asyncio.gather(inner(a), inner(b))
f = asyncio.ensure_future(outer(), loop=self.one_loop)
test_utils.run_briefly(self.one_loop)
@@ -3705,7 +3710,7 @@ class CompatibilityTests(test_utils.TestCase):
return 'ok2'
async def inner():
- return await asyncio.gather(coro1(), coro2(), loop=self.loop)
+ return await asyncio.gather(coro1(), coro2())
result = self.loop.run_until_complete(inner())
self.assertEqual(['ok1', 'ok2'], result)