diff --git a/tests/test_gui_context_presets.py b/tests/test_gui_context_presets.py index f8884de1..d1d0f50a 100644 --- a/tests/test_gui_context_presets.py +++ b/tests/test_gui_context_presets.py @@ -45,11 +45,14 @@ def test_gui_context_preset_save_load(live_gui) -> None: client.push_event("custom_callback", {"callback": "load_context_preset", "args": [preset_name]}) time.sleep(1.0) - # DEBUG: Print the background process log + # DEBUG: Print the background process log (binary mode because the + # GUI process writes Windows console output that isn't valid UTF-8) log_path = os.path.join("logs", "sloppy_py_test.log") if os.path.exists(log_path): - with open(log_path, "r", encoding="utf-8") as f: - print(f"BACKGROUND LOG:\n{f.read()}") + with open(log_path, "rb") as f: + raw = f.read() + text = raw.decode("utf-8", errors="replace") + print(f"BACKGROUND LOG:\n{text}") context = client.get_context_state() loaded_files = [f["path"] if isinstance(f, dict) else str(f) for f in context.get("files", [])]