diff options
author | Zac Medico <zmedico@gentoo.org> | 2021-01-18 03:56:16 -0800 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2021-01-18 03:56:42 -0800 |
commit | 447ce6fa4a081ff416431a00a43827f67468b015 (patch) | |
tree | 74f46e686d39a5acf669b68ed9c899ac4712eccc | |
parent | AsyncFunctionTestCase: Use async and await syntax (diff) | |
download | portage-447ce6fa4a081ff416431a00a43827f67468b015.tar.gz portage-447ce6fa4a081ff416431a00a43827f67468b015.tar.bz2 portage-447ce6fa4a081ff416431a00a43827f67468b015.zip |
ChildWatcherTestCase: Use async and await syntax
Signed-off-by: Zac Medico <zmedico@gentoo.org>
-rw-r--r-- | lib/portage/tests/util/futures/asyncio/test_child_watcher.py | 10 |
1 files 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()): |