Skip to content

test(windows): normalize path separators in 8 wiki override assertions (#643)#718

Merged
memtomem merged 1 commit intomainfrom
test/wiki-cmd-override-windows-paths
May 2, 2026
Merged

test(windows): normalize path separators in 8 wiki override assertions (#643)#718
memtomem merged 1 commit intomainfrom
test/wiki-cmd-override-windows-paths

Conversation

@memtomem
Copy link
Copy Markdown
Owner

@memtomem memtomem commented May 2, 2026

Summary

What's NOT changed

wiki_cmd.py is untouched. click.edit(filename=str(result.path)) (line 87) intentionally hands the editor a platform-native path — Windows users want notepad.exe to receive C:\...\overrides\claude.md, not a POSIX path. Same trade-off as PR #711's norm_path().

The 8 sites

Line Test Pattern
253 test_wiki_skill_override_invokes_editor A: endswith
291 test_wiki_skill_override_stdout_contract B: stdout-contract block
344 test_wiki_agent_override_warns_on_dropped_fields B: inline
439 test_wiki_agent_override_invokes_editor A: endswith
474 test_wiki_agent_override_stdout_contract B: stdout-contract block
521 test_wiki_command_override_warns_on_dropped_fields B: inline
630 test_wiki_command_override_invokes_editor A: endswith
663 test_wiki_command_override_stdout_contract B: stdout-contract block

Pattern A — endswith on captured[0] (3 sites)

Direct PR #711 mirror: wrap LHS in Path(...).as_posix().

- assert captured[0].endswith("/skills/hello/overrides/claude.md")
+ assert Path(captured[0]).as_posix().endswith("/skills/hello/overrides/claude.md")

Pattern B — Seeded ... substring on result.output (5 sites)

Substring "in" check can't as_posix() a path embedded inside a multi-line blob. Normalize result.output.replace("\\", "/") instead. For the 3 stdout-contract tests, normalize out once at the top and flip the adjacent str(target_path) in out to target_path.as_posix() in out to stay symmetric (otherwise: LHS keeps \, RHS now /, silent break on Windows).

Test plan

Out of scope

wiki_cmd.py line 71 (Seeded {rel}) and line 75 (git add ...) emit different separators on the same screen on Windows (cosmetic UX inconsistency). Could be a separate one-line PR ({rel.as_posix()}); deliberately not bundled here to keep the sweep mechanically test-only.

🤖 Generated with Claude Code

#643)

The 8 tests in `test_wiki_cmd_override.py` asserted forward-slash literals
against output that contains platform-native separators on Windows,
causing failures on the Windows CI job for the #643 sweep.

Mirrors PR #711 (commit b04dcdb) — production code is correct as-is, only
test assertions need to bridge the separator gap. `wiki_cmd.py` is
unmodified: `click.edit(filename=str(result.path))` (line 87) intentionally
hands the editor a platform-native path (Windows users want notepad.exe to
receive `C:\...\overrides\claude.md`, not a POSIX path), same trade-off as
PR #711's `norm_path()`.

Two patterns:

- 3 `endswith` on `captured[0]` (the filename passed to click.edit) →
  wrap LHS in `Path(...).as_posix()` (direct PR #711 mirror).
- 5 `Seeded ...` substring on `result.output` → substring "in" can't
  as_posix() a path embedded inside a multi-line blob, so normalize
  `result.output.replace("\\\\", "/")` instead. For the 3 stdout-contract
  tests this is a one-time per-test normalization at the top, with the
  adjacent `str(target_path) in out` assertion flipped to
  `target_path.as_posix() in out` to stay symmetric (otherwise the
  trap: LHS keeps `\\`, RHS now has `/`, silent break on Windows).

POSIX behavior: replace is a no-op (verified locally — 32/32 pass on
macOS), so existing CI stays green.

Co-Authored-By: Claude <[email protected]>
@memtomem memtomem merged commit c95cbd2 into main May 2, 2026
8 of 9 checks passed
@memtomem memtomem deleted the test/wiki-cmd-override-windows-paths branch May 2, 2026 07:10
@github-actions github-actions Bot locked and limited conversation to collaborators May 2, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants