Skip to content

fix: make the test suite pass on Windows - #70

Open
maceorichards wants to merge 1 commit into
developfrom
fix/windows-test-suite
Open

maceorichards wants to merge 1 commit into
developfrom
fix/windows-test-suite

Conversation

@maceorichards

Copy link
Copy Markdown
Owner

Summary

The unit suite now passes on Windows: 405 tests, OK (29 skipped). Before this change it had 55 failures and 130 errors. The real home folder stays unchanged across runs.

Test harness (tests/harness.py)

  • Runs sync.sh through Git Bash (script_argv), since Windows can't run shebang scripts.
  • set_home() points both HOME and USERPROFILE at the sandbox. Python on Windows reads USERPROFILE, so without this the tests wrote into the real profile (Tests write to the real user profile on Windows: HOME doesn't redirect ~ #67).
  • link_dir() falls back to a directory junction when symlinks aren't allowed.
  • rmtree() clears read-only flags (git object files) on cleanup.
  • install_python_command() wraps the fake CLIs in a pip/distlib .exe launcher on Windows.
  • Subprocess output is decoded as UTF-8.
  • Skip decorators: requires_symlinks (13 tests; Windows needs Developer Mode or admin) and requires_posix_permissions (16 tests; Windows can't make folders read-only).

lib/sync.py

Other test fixes

  • gitconfig paths escape backslashes; files opened with explicit UTF-8; fake_cli.py strips .exe from its program name.

Not verified

  • Only run on Windows. The POSIX code paths are meant to be unchanged, but Linux and macOS CI should confirm.
  • Run the unit suite on windows-latest #51 also asks for windows-latest in the CI unit matrix; that's not in this PR.

Refs #51. Fixes #67, #68, #69.

🤖 Generated with Claude Code

Tests now run sync.sh through Git Bash, point both HOME and USERPROFILE
at the sandbox (Python on Windows reads USERPROFILE), fall back to a
directory junction for the vendor link, clear read-only flags when
cleaning up, read output as UTF-8, and wrap the fake CLIs in .exe
launchers. Tests that need symlinks or read-only folders skip on
Windows with a reason.

sync.py fixes:
- tilde() shows paths under home as ~/... with forward slashes on Windows
- removing the devflow section from a CRLF file no longer leaves a blank line

Refs #51. Fixes #67, #68, #69.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

Tests write to the real user profile on Windows: HOME doesn't redirect ~

1 participant