test_console_output: Fix WrappedIO.writelines with iterator.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2023-04-25 17:51:26 -07:00 committed by Anders Kaseorg
parent 5ecff88c1b
commit f74cfe0ed5
1 changed files with 3 additions and 1 deletions

View File

@ -1,3 +1,4 @@
import itertools
import logging
import re
import sys
@ -102,8 +103,9 @@ class WrappedIO(IO[bytes]):
return num_chars
def writelines(self, data: Iterable[bytes]) -> None:
data, data_copy = itertools.tee(data)
self.stream.writelines(data)
lines = b"".join(data)
lines = b"".join(data_copy)
self.extra_output_finder.find_extra_output(lines)
def __next__(self) -> bytes: