Skip to content

Windows: replace POSIX path-separator assertions in tests (/ vs \\) #643

@memtomem

Description

@memtomem

Background

Tests assert against path strings using POSIX `/` separators, breaking on Windows where `str(Path(...))` produces `\` separators.

Surfaces in PR #638's first Windows matrix run.

Symptoms

```
FAILED test_wiki_cmd_override.py::test_wiki_skill_override_invokes_editor
assert False

  • where False = '...\\skills\\hello\\overrides\\claude.md'.endswith('/skills/hello/overrides/claude.md')

FAILED test_wiki_cmd_override.py::test_wiki_skill_override_stdout_contract
assert 'Seeded skills/hello/overrides/codex.md' in 'Seeded skills\\hello\\overrides\\codex.md\n...'
```

Affected files (8+ tests known)

  • `packages/memtomem/tests/test_wiki_cmd_override.py` — 8 failures (all endswith / substring of POSIX paths)
  • Likely scattered in: `test_uninstall_cmd.py`, `test_web_routes.py`, `test_init_cmd.py` (subset of their failures)

Fix pattern

Three options per call site:

  • `endswith(os.path.join("skills", ...))` — uses native sep
  • `Path(actual).as_posix().endswith("/...")` — normalize actual to POSIX
  • `actual.replace(os.sep, "/")` then compare — cheapest at scale

`as_posix()` is usually cleanest for assertion targets that already exist as Paths. Production code (CLI stdout) should be audited too — if `mm wiki skill override` prints `Seeded skills\hello\overrides\codex.md` on Windows, that's arguably a UX fix rather than a test-only fix.

Refs

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions