aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2020-03-07 23:31:08 -0800
committerZac Medico <zmedico@gentoo.org>2020-03-07 23:31:50 -0800
commit0552665627bf85f01ae28cafebc885dcb6d26ef3 (patch)
tree0328dc6916709a73e014d46d77ca7a61dd9155b4 /lib/portage/tests/emerge/test_simple.py
parentUpdates for portage-2.3.93 release (diff)
downloadportage-0552665627bf85f01ae28cafebc885dcb6d26ef3.tar.gz
portage-0552665627bf85f01ae28cafebc885dcb6d26ef3.tar.bz2
portage-0552665627bf85f01ae28cafebc885dcb6d26ef3.zip
SimpleEmergeTestCase: run tests in coroutine method
Signed-off-by: Zac Medico <zmedico@gentoo.org>
Diffstat (limited to 'lib/portage/tests/emerge/test_simple.py')
-rw-r--r--lib/portage/tests/emerge/test_simple.py25
1 files changed, 18 insertions, 7 deletions
diff --git a/lib/portage/tests/emerge/test_simple.py b/lib/portage/tests/emerge/test_simple.py
index f5cd6f3d2..6aafff180 100644
--- a/lib/portage/tests/emerge/test_simple.py
+++ b/lib/portage/tests/emerge/test_simple.py
@@ -1,4 +1,4 @@
-# Copyright 2011-2019 Gentoo Authors
+# Copyright 2011-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
import subprocess
@@ -14,6 +14,9 @@ from portage.tests import TestCase
from portage.tests.resolver.ResolverPlayground import ResolverPlayground
from portage.util import (ensure_dirs, find_updated_config_files,
shlex_split)
+from portage.util.futures import asyncio
+from portage.util.futures.compat_coroutine import coroutine
+
class SimpleEmergeTestCase(TestCase):
@@ -201,6 +204,15 @@ call_has_and_best_version() {
playground = ResolverPlayground(
ebuilds=ebuilds, installed=installed, debug=debug)
+
+ loop = asyncio._wrap_loop()
+ loop.run_until_complete(asyncio.ensure_future(
+ self._async_test_simple(playground, metadata_xml_files), loop=loop))
+
+ @coroutine
+ def _async_test_simple(self, playground, metadata_xml_files):
+
+ debug = playground.debug
settings = playground.settings
eprefix = settings["EPREFIX"]
eroot = settings["EROOT"]
@@ -487,15 +499,14 @@ move dev-util/git dev-vcs/git
else:
local_env = env
- proc = subprocess.Popen(args,
- env=local_env, stdout=stdout)
+ proc = yield asyncio.create_subprocess_exec(*args,
+ env=local_env, stderr=None, stdout=stdout)
if debug:
- proc.wait()
+ yield proc.wait()
else:
- output = proc.stdout.readlines()
- proc.wait()
- proc.stdout.close()
+ output, _err = yield proc.communicate()
+ yield proc.wait()
if proc.returncode != os.EX_OK:
for line in output:
sys.stderr.write(_unicode_decode(line))