Skip to content

Make the CLI and its tests behave the same on Windows - #5

Merged
joszamama merged 2 commits into
mainfrom
windows-tests
Oct 8, 2026
Merged

joszamama merged 2 commits into
mainfrom
windows-tests

Conversation

@joszamama

Copy link
Copy Markdown
Member

The first run of tests.yml on GitHub failed 16 tests on Windows (868 passed); Linux, macOS and the type check passed. Most were tests that assumed / or a POSIX home directory, but three were real behaviour of the package.

The package

  • fanbase diff read the installed copy as text and the registry's copy as bytes. Python turns CRLF into LF when it reads text, so a spec with CRLF line endings showed every line as changed against itself. This happened on any system, and Windows only made it show. Both sides are bytes now.
  • A target whose command cannot be started is an error verdict, as it already was on POSIX (behind the limits wrapper it is exit status 127). On Windows it was an exception that stopped the evaluation of everything.
  • The files of a registry (index.yml, metadata.yml, a new spec) are written with LF on every system. A maintainer signs the bytes of index.yml, and writing it in text mode on Windows makes it CRLF. The messages that name a path in the registry (created, forked, kept, wrote doi) use / everywhere.

The tests

  • Fixtures write spec files byte for byte (the tests hash them), expected paths are compared with /, the fake home is set for USERPROFILE as well as HOME, and the placeholder test no longer puts a path into Python source (a backslash is an escape there).
  • Three new tests, each shown to fail without its fix: diff of a CRLF spec, a registry's files have no CR, and a command that cannot be started.

How was it tested?

macOS: 958 passed, 1 skipped, and mypy src is clean. I cannot run Windows myself: this pull request's tests jobs are the check, and if some fail I will push more commits here rather than guess.

…g command

- diff read the installed copy as text and the registry's as bytes, so a spec with CRLF line endings
  showed every line as changed against itself, on any system. Both sides are bytes now.
- The files of a registry (index.yml, metadata.yml, a new spec) are written with LF on every system:
  a maintainer signs the bytes of index.yml, and text mode would make them CRLF on Windows.
- The messages that name a path in the registry (created, forked, kept, wrote doi) use / on every system.
- A target whose command cannot be started is an error verdict, as it already was behind the POSIX
  limits wrapper (exit status 127), and not an exception that stops the evaluation on Windows.
…hs, the Windows home

The fixtures write spec files byte for byte (the tests hash them), the expected paths of the fake
Fandango and of the site are compared with /, the home directory is set for USERPROFILE as well as HOME,
and the placeholder test no longer puts a path into Python source, where a backslash is an escape.
@joszamama
joszamama merged commit a7f5e8e into main Oct 8, 2026
7 checks passed
@joszamama
joszamama deleted the windows-tests branch October 8, 2026 22:36
@joszamama joszamama mentioned this pull request Oct 9, 2026
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.

1 participant