public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Zac Medico" <zmedico@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:master commit in: lib/portage/tests/process/
Date: Mon, 18 Jan 2021 12:20:17 +0000 (UTC)	[thread overview]
Message-ID: <1610970610.b7469f2f9777e818e9c0f3fa46e90c3f7f1c904a.zmedico@gentoo> (raw)

commit:     b7469f2f9777e818e9c0f3fa46e90c3f7f1c904a
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 18 11:49:28 2021 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Jan 18 11:50:10 2021 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=b7469f2f

AsyncFunctionTestCase: Use async and await syntax

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

 lib/portage/tests/process/test_AsyncFunction.py | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/lib/portage/tests/process/test_AsyncFunction.py b/lib/portage/tests/process/test_AsyncFunction.py
index b3f80b8ac..ce4b2a93b 100644
--- a/lib/portage/tests/process/test_AsyncFunction.py
+++ b/lib/portage/tests/process/test_AsyncFunction.py
@@ -1,4 +1,4 @@
-# Copyright 2020 Gentoo Authors
+# Copyright 2020-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 import sys
@@ -9,7 +9,6 @@ from portage.tests import TestCase
 from portage.util._async.AsyncFunction import AsyncFunction
 from portage.util.futures import asyncio
 from portage.util.futures._asyncio.streams import _writer
-from portage.util.futures.compat_coroutine import coroutine
 from portage.util.futures.unix_events import _set_nonblocking
 
 
@@ -20,8 +19,7 @@ class AsyncFunctionTestCase(TestCase):
 		os.close(pw)
 		return ''.join(sys.stdin)
 
-	@coroutine
-	def _testAsyncFunctionStdin(self, loop=None):
+	async def _testAsyncFunctionStdin(self, loop):
 		test_string = '1\n2\n3\n'
 		pr, pw = os.pipe()
 		fd_pipes = {0:pr}
@@ -30,8 +28,8 @@ class AsyncFunctionTestCase(TestCase):
 		os.close(pr)
 		_set_nonblocking(pw)
 		with open(pw, mode='wb', buffering=0) as pipe_write:
-			yield _writer(pipe_write, test_string.encode('utf_8'), loop=loop)
-		self.assertEqual((yield reader.async_wait()), os.EX_OK)
+			await _writer(pipe_write, test_string.encode('utf_8'))
+		self.assertEqual((await reader.async_wait()), os.EX_OK)
 		self.assertEqual(reader.result, test_string)
 
 	def testAsyncFunctionStdin(self):


             reply	other threads:[~2021-01-18 12:20 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-18 12:20 Zac Medico [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-02-28  6:26 [gentoo-commits] proj/portage:master commit in: lib/portage/tests/process/ Zac Medico
2024-02-25  0:45 Zac Medico
2024-02-09  7:08 Sam James
2024-02-03 22:54 Zac Medico
2023-11-02 14:57 Zac Medico
2023-05-26 15:45 Sam James
2023-05-26 15:45 Sam James
2023-05-26 15:45 Sam James
2023-05-26 15:45 Sam James
2021-01-18 12:20 Zac Medico
2019-08-31  3:10 Zac Medico
2019-04-14 19:45 Zac Medico

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1610970610.b7469f2f9777e818e9c0f3fa46e90c3f7f1c904a.zmedico@gentoo \
    --to=zmedico@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox