From 447ce6fa4a081ff416431a00a43827f67468b015 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Mon, 18 Jan 2021 03:56:16 -0800 Subject: ChildWatcherTestCase: Use async and await syntax Signed-off-by: Zac Medico --- lib/portage/tests/util/futures/asyncio/test_child_watcher.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/portage/tests/util/futures/asyncio/test_child_watcher.py b/lib/portage/tests/util/futures/asyncio/test_child_watcher.py index cd547f008..4e7b4fd7f 100644 --- a/lib/portage/tests/util/futures/asyncio/test_child_watcher.py +++ b/lib/portage/tests/util/futures/asyncio/test_child_watcher.py @@ -1,4 +1,4 @@ -# Copyright 2018-2019 Gentoo Authors +# Copyright 2018-2021 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 import os @@ -7,7 +7,6 @@ from portage.process import find_binary, spawn from portage.tests import TestCase from portage.util._eventloop.global_event_loop import global_event_loop from portage.util.futures import asyncio -from portage.util.futures.compat_coroutine import coroutine from portage.util.futures.unix_events import DefaultEventLoopPolicy @@ -37,17 +36,16 @@ class ChildWatcherTestCase(TestCase): def callback(pid, returncode, *args): future.set_result((pid, returncode, args)) - @coroutine - def watch_pid(loop=None): + async def watch_pid(): with asyncio.get_child_watcher() as watcher: pids = spawn([true_binary], returnpid=True) watcher.add_child_handler(pids[0], callback, *args_tuple) self.assertEqual( - (yield future), + (await future), (pids[0], os.EX_OK, args_tuple)) - loop.run_until_complete(watch_pid(loop=loop)) + loop.run_until_complete(watch_pid()) finally: asyncio.set_event_loop_policy(initial_policy) if loop not in (None, global_event_loop()): -- cgit v1.2.3-65-gdbad