Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

test_console_output: Fix WrappedIO.writelines with iterator.

Anders Kaseorgf74cfe0ed5c3
diff --git a/zerver/lib/test_console_output.py b/zerver/lib/test_console_output.py
index a0561168df8..e149dd1a06e 100644
--- a/zerver/lib/test_console_output.py
+++ b/zerver/lib/test_console_output.py
@@ -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: