From e8f891fabfa37567a93cc143010b2911b46a0091 Mon Sep 17 00:00:00 2001 From: Daniel Meppiel Date: Sun, 3 May 2026 20:10:21 +0200 Subject: [PATCH] test(command-integrator): write _make_package fixtures as utf-8 bytes for Windows The _make_package helper used by TestCursorCommandPanelFindings calls Path.write_text(content), which on Windows defaults to the cp1252 encoder and raises UnicodeEncodeError on the U+E041 tag character that test_critical_security_finding_blocks_write deliberately injects to exercise the post-transform critical-finding gate. Switch to write_bytes(content.encode('utf-8')), matching the canonical pattern already used in this repo for fixture content that must round- trip exactly (sha256 integrity helpers in tests/unit/install/ and tests/unit/bundle/). This also avoids write_text's Windows newline translation, so the bytes on disk match the literal test input. Failing run: https://github.com/microsoft/apm/actions/runs/25286532040 job 74131700555 (Build & Test, windows-latest). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- tests/unit/integration/test_command_integrator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/integration/test_command_integrator.py b/tests/unit/integration/test_command_integrator.py index 561a4069..b99703e5 100644 --- a/tests/unit/integration/test_command_integrator.py +++ b/tests/unit/integration/test_command_integrator.py @@ -34,7 +34,7 @@ def _make_package(project_root, prompts): prompts_dir = pkg_dir / ".apm" / "prompts" prompts_dir.mkdir(parents=True) for name, content in prompts.items(): - (prompts_dir / name).write_text(content) + (prompts_dir / name).write_bytes(content.encode("utf-8")) mock_info = MagicMock() mock_info.install_path = pkg_dir