Skip to content

fix: resolve 15 Windows test failures across 8 test files#193

Open
Nyquist24 wants to merge 1 commit intoaiming-lab:mainfrom
Nyquist24:fix/windows-test-compat
Open

fix: resolve 15 Windows test failures across 8 test files#193
Nyquist24 wants to merge 1 commit intoaiming-lab:mainfrom
Nyquist24:fix/windows-test-compat

Conversation

@Nyquist24
Copy link
Copy Markdown
Contributor

Summary

Following up on the CI workflow added in #176, the Windows job revealed 18 test failures. This PR fixes 15 of them across 8 test files — all changes are in test code only, no production code modified.

Root causes addressed

Category Tests fixed Fix
UTF-8 encoding 9 Add encoding="utf-8" to .read_text() / .open() — Windows defaults to system locale (GBK, Shift-JIS, CP1252, etc.) which can't decode UTF-8 files
Docker --user flag 3 Source correctly skips --user on Windows (os.getuid is POSIX-only); update assertions to match
Path separator 1 Compare as Path objects instead of string literals (\ vs /)
Backslash in generated scripts 1 Use os.path.join(r"...", ...) to avoid \U unicode escape errors
Symlink privilege 1 Skip on Windows where symlinks require admin or Developer Mode

Not addressed (upstream issue)

The remaining 3 failures (test_skills_library) are an upstream count mismatch (16 SKILL.md files on disk vs 19 asserted) and fail on all platforms — not addressed here.

Several tests fail on Windows due to platform-specific assumptions:

- **UTF-8 encoding (9 tests):** `.read_text()` and `.open()` without
  explicit encoding default to the system locale (GBK, Shift-JIS, etc.)
  on non-UTF-8 Windows systems, causing UnicodeDecodeError. Explicitly
  pass `encoding="utf-8"` to match the encoding used when writing.

- **Docker --user flag (3 tests):** `os.getuid()`/`os.getgid()` are
  POSIX-only. The source code already skips `--user` on Windows, so
  update test assertions to match this platform-aware behavior.

- **Path separators (1 test):** Compare as `Path` objects instead of
  string literals to handle `\` vs `/` differences.

- **Backslash escaping (1 test):** Use `os.path.join(r"...", ...)` for
  paths embedded in generated scripts to avoid `\U` unicode escapes.

- **Symlinks (1 test):** Skip on Windows where creating symlinks
  requires admin privileges or Developer Mode.

The remaining 3 failures (test_skills_library) are an upstream count
mismatch (16 SKILL.md files on disk vs 19 asserted) and fail on all
platforms — not addressed here.
@r78zyang
Copy link
Copy Markdown

Great news for Windows users!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants