From 2bd635853bcd03007db451e7e79466b1fcf292e9 Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Mon, 2 Aug 2021 14:41:26 -0700 Subject: [PATCH] test-run-dev: Fix log file opening. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Partially reverts commit cc55393671b4d51f4997e169b15ce0f7175157ea. mode="r" cannot be combined with buffering=0. This is not a correct thing to do, since a multibyte character might get split between two binary reads and cause UnicodeDecodeError, but it’s good enough for a known-broken test we don’t run. Signed-off-by: Anders Kaseorg --- tools/test-run-dev | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/test-run-dev b/tools/test-run-dev index 204ca83a42..9be38c698a 100755 --- a/tools/test-run-dev +++ b/tools/test-run-dev @@ -17,13 +17,13 @@ TOOLS_DIR = os.path.dirname(os.path.abspath(__file__)) def start_server(logfile_name: str) -> Tuple[bool, str]: failure = True - key = "Quit the server with CTRL-C." + key = "Quit the server with CONTROL-C." datalog = [] - with open(logfile_name, "r", buffering=0) as logfile: + with open(logfile_name, "rb", buffering=0) as logfile: for i in range(200): time.sleep(0.5) print(f"{i}. Polling run-dev...") - new_data = logfile.read() + new_data = logfile.read().decode() if new_data: datalog.append(new_data)