Skip to content

Commit cb898ce

Browse files
committed
test(integrations): restore the kiro prompt as bytes in the upgrade test
test_upgrade_replaces_dotted_kiro_prompts restored the edited prompt with write_text(), which writes CRLF on Windows. Integration files are written as LF bytes, so the restored file no longer matched its manifest hash and the second upgrade was still blocked as modified (pytest on windows-latest). Read and write the prompt as bytes. Refs #4797 Assisted-by: Claude Code (model: claude-opus-5-5, autonomous)
1 parent 86afed7 commit cb898ce

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

‎tests/specify_cli/integrations/test_command_upgrade.py‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -312,15 +312,17 @@ def test_upgrade_replaces_dotted_kiro_prompts(self, tmp_path, monkeypatch):
312312
project = _init_project(tmp_path, "kiro-cli")
313313
prompts = project / ".kiro" / "prompts"
314314
dotted_plan = prompts / "speckit.plan.md"
315-
original = dotted_plan.read_text(encoding="utf-8")
315+
# Bytes, not text: write_text() would turn "\n" into "\r\n" on
316+
# Windows, so the restored file would no longer match the manifest.
317+
original = dotted_plan.read_bytes()
316318

317-
dotted_plan.write_text(original + "my note\n", encoding="utf-8")
319+
dotted_plan.write_bytes(original + b"my note\n")
318320
blocked = _run_in_project(project, ["integration", "upgrade", "kiro-cli"])
319321
assert blocked.exit_code != 0
320322
assert "speckit.plan.md" in blocked.output
321-
assert dotted_plan.read_text(encoding="utf-8") == original + "my note\n"
323+
assert dotted_plan.read_bytes() == original + b"my note\n"
322324

323-
dotted_plan.write_text(original, encoding="utf-8")
325+
dotted_plan.write_bytes(original)
324326
result = _run_in_project(project, ["integration", "upgrade", "kiro-cli"])
325327
assert result.exit_code == 0, result.output
326328
assert sorted(prompts.glob("speckit.*.md")) == []

0 commit comments

Comments
 (0)