aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHemmo Nieminen <hemmo.nieminen@iki.fi>2022-02-01 00:00:00 +0200
committerEli Schwartz <eschwartz93@gmail.com>2022-06-09 18:58:33 -0400
commitd6e1b72db0bc09a1af7ad28f883a9133ed4406ff (patch)
treef42235233eb239436d7632a73a092310944d0500
parentcb0cbb3e5e43ade289f0d4f7fd0feaced55149a1 (diff)
downloadmeson-d6e1b72db0bc09a1af7ad28f883a9133ed4406ff.zip
meson-d6e1b72db0bc09a1af7ad28f883a9133ed4406ff.tar.gz
meson-d6e1b72db0bc09a1af7ad28f883a9133ed4406ff.tar.bz2
mtest: remove unused arguments from read_decode_lines()
The only time the argument would matter (console_mode == ConsoleUser.STDOUT) never happens as the only time the function is ever called is when parsing of the output is needed which in turns implies that console_mode != ConsoleUser.STDOUT.
-rw-r--r--mesonbuild/mtest.py12
1 files changed, 5 insertions, 7 deletions
diff --git a/mesonbuild/mtest.py b/mesonbuild/mtest.py
index 4c8cb82..31349ea 100644
--- a/mesonbuild/mtest.py
+++ b/mesonbuild/mtest.py
@@ -1120,15 +1120,13 @@ async def read_decode(reader: asyncio.StreamReader, console_mode: ConsoleUser) -
# Extract lines out of the StreamReader. Print them
# along the way if requested, and at the end collect
# them all into a future.
-async def read_decode_lines(reader: asyncio.StreamReader, q: 'asyncio.Queue[T.Optional[str]]',
- console_mode: ConsoleUser) -> str:
+async def read_decode_lines(reader: asyncio.StreamReader,
+ q: 'asyncio.Queue[T.Optional[str]]') -> str:
stdo_lines = []
try:
while not reader.at_eof():
line = decode(await reader.readline())
stdo_lines.append(line)
- if console_mode is ConsoleUser.STDOUT:
- print(line, end='', flush=True)
await q.put(line)
return ''.join(stdo_lines)
except asyncio.CancelledError:
@@ -1217,9 +1215,9 @@ class TestSubprocess:
self.postwait_fn = postwait_fn # type: T.Callable[[], None]
self.all_futures = [] # type: T.List[asyncio.Future]
- def stdout_lines(self, console_mode: ConsoleUser) -> T.AsyncIterator[str]:
+ def stdout_lines(self) -> T.AsyncIterator[str]:
q = asyncio.Queue() # type: asyncio.Queue[T.Optional[str]]
- decode_coro = read_decode_lines(self._process.stdout, q, console_mode)
+ decode_coro = read_decode_lines(self._process.stdout, q)
self.stdo_task = asyncio.ensure_future(decode_coro)
return queue_iter(q)
@@ -1464,7 +1462,7 @@ class SingleTestRunner:
parse_task = None
if self.runobj.needs_parsing:
- parse_coro = self.runobj.parse(harness, p.stdout_lines(self.console_mode))
+ parse_coro = self.runobj.parse(harness, p.stdout_lines())
parse_task = asyncio.ensure_future(parse_coro)
stdo_task, stde_task = p.communicate(self.console_mode)