commit:     447ce6fa4a081ff416431a00a43827f67468b015
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 18 11:56:16 2021 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Jan 18 11:56:42 2021 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=447ce6fa

ChildWatcherTestCase: Use async and await syntax

Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>

 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()):

Reply via email to