diff options
author | Andrew Svetlov <andrew.svetlov@gmail.com> | 2019-09-12 15:40:40 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-12 15:40:40 +0300 |
commit | a488879cbaf4b8b52699cadccf73bb4c271bcb29 (patch) | |
tree | de6a1f6a029e3572ea749e6fe81bc461bf0c1732 /Lib/test/test_asyncio/test_tasks.py | |
parent | 3ab61473ba7f3dca32d779ec2766a4faa0657923 (diff) | |
download | cpython-a488879cbaf4b8b52699cadccf73bb4c271bcb29.tar.gz cpython-a488879cbaf4b8b52699cadccf73bb4c271bcb29.zip |
bpo-36373: Deprecate explicit loop in task and subprocess API (GH-16033)
Diffstat (limited to 'Lib/test/test_asyncio/test_tasks.py')
-rw-r--r-- | Lib/test/test_asyncio/test_tasks.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/Lib/test/test_asyncio/test_tasks.py b/Lib/test/test_asyncio/test_tasks.py index 3fbb2a1a162..6e832eab6d5 100644 --- a/Lib/test/test_asyncio/test_tasks.py +++ b/Lib/test/test_asyncio/test_tasks.py @@ -1810,7 +1810,7 @@ class BaseTaskTests: async def outer(): nonlocal proof - await asyncio.shield(inner(), loop=self.loop) + await asyncio.shield(inner()) proof += 100 f = asyncio.ensure_future(outer(), loop=self.loop) @@ -1825,8 +1825,8 @@ class BaseTaskTests: def test_shield_gather(self): child1 = self.new_future(self.loop) child2 = self.new_future(self.loop) - parent = asyncio.gather(child1, child2, loop=self.loop) - outer = asyncio.shield(parent, loop=self.loop) + parent = asyncio.gather(child1, child2) + outer = asyncio.shield(parent) test_utils.run_briefly(self.loop) outer.cancel() test_utils.run_briefly(self.loop) @@ -1839,9 +1839,9 @@ class BaseTaskTests: def test_gather_shield(self): child1 = self.new_future(self.loop) child2 = self.new_future(self.loop) - inner1 = asyncio.shield(child1, loop=self.loop) - inner2 = asyncio.shield(child2, loop=self.loop) - parent = asyncio.gather(inner1, inner2, loop=self.loop) + inner1 = asyncio.shield(child1) + inner2 = asyncio.shield(child2) + parent = asyncio.gather(inner1, inner2) test_utils.run_briefly(self.loop) parent.cancel() # This should cancel inner1 and inner2 but bot child1 and child2. @@ -2981,7 +2981,8 @@ class FutureGatherTests(GatherTestsBase, test_utils.TestCase): self._run_loop(self.one_loop) self.assertTrue(fut.done()) self.assertEqual(fut.result(), []) - fut = asyncio.gather(*seq_or_iter, loop=self.other_loop) + with self.assertWarns(DeprecationWarning): + fut = asyncio.gather(*seq_or_iter, loop=self.other_loop) self.assertIs(fut._loop, self.other_loop) def test_constructor_empty_sequence(self): |