1 |
commit: ca08349fbec86a323037d5391717c10abc0421a8 |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Apr 14 19:42:36 2019 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Apr 14 19:44:21 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=ca08349f |
7 |
|
8 |
PipeReaderTestCase: use asyncio.create_subprocess_exec |
9 |
|
10 |
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org> |
11 |
|
12 |
lib/portage/tests/process/test_poll.py | 20 +++++++++----------- |
13 |
1 file changed, 9 insertions(+), 11 deletions(-) |
14 |
|
15 |
diff --git a/lib/portage/tests/process/test_poll.py b/lib/portage/tests/process/test_poll.py |
16 |
index f700a5585..f505b5049 100644 |
17 |
--- a/lib/portage/tests/process/test_poll.py |
18 |
+++ b/lib/portage/tests/process/test_poll.py |
19 |
@@ -1,4 +1,4 @@ |
20 |
-# Copyright 1998-2018 Gentoo Foundation |
21 |
+# Copyright 1998-2019 Gentoo Authors |
22 |
# Distributed under the terms of the GNU General Public License v2 |
23 |
|
24 |
import functools |
25 |
@@ -6,13 +6,12 @@ import pty |
26 |
import shutil |
27 |
import socket |
28 |
import sys |
29 |
-import subprocess |
30 |
import tempfile |
31 |
|
32 |
from portage import os |
33 |
from portage.tests import TestCase |
34 |
-from portage.util._async.PopenProcess import PopenProcess |
35 |
from portage.util._eventloop.global_event_loop import global_event_loop |
36 |
+from portage.util.futures import asyncio |
37 |
from _emerge.PipeReader import PipeReader |
38 |
|
39 |
class PipeReaderTestCase(TestCase): |
40 |
@@ -68,17 +67,16 @@ class PipeReaderTestCase(TestCase): |
41 |
input_files={"producer" : master_file}, |
42 |
_use_array=self._use_array, |
43 |
scheduler=scheduler) |
44 |
+ consumer.start() |
45 |
|
46 |
- producer = PopenProcess( |
47 |
- pipe_reader=consumer, |
48 |
- proc=subprocess.Popen(["bash", "-c", self._echo_cmd % test_string], |
49 |
- stdout=slave_fd), |
50 |
- scheduler=scheduler) |
51 |
+ producer = scheduler.run_until_complete(asyncio.create_subprocess_exec( |
52 |
+ "bash", "-c", self._echo_cmd % test_string, |
53 |
+ stdout=slave_fd, |
54 |
+ loop=scheduler)) |
55 |
|
56 |
- producer.start() |
57 |
os.close(slave_fd) |
58 |
- producer.wait() |
59 |
- consumer.wait() |
60 |
+ scheduler.run_until_complete(producer.wait()) |
61 |
+ scheduler.run_until_complete(consumer.async_wait()) |
62 |
|
63 |
self.assertEqual(producer.returncode, os.EX_OK) |
64 |
self.assertEqual(consumer.returncode, os.EX_OK) |