Repository navigation
test(tactics): Write the strategy fixture as bytes so windows matches the pin - #255
Merged
Merged
Conversation
… the pin The converter pins its source by the sha256 of the bytes on disk, and the test helper wrote the fixture with write_text and hashed the string it had just written. On linux those are the same bytes. On windows write_text translates every newline into a carriage return and a newline, so the file on disk is not the file the pin was taken over, and the script refused its own fixture. Two tests failed from it. Write the encoded bytes instead, and take the pin over the same bytes. This is not a line ending problem in the checkout. The fixture is built in tmp_path at run time and the real source is downloaded rather than committed, so no .gitattributes rule reaches either. The Scripts workflow runs on ubuntu only, which is why this sat here rather than failing in ci. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Contributor
Speed against
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two tests in
scripts/tests/test_build_strategy.pyfail on a windowscheckout. They have been failing for a while rather than recently: the
Scripts workflow runs on ubuntu only, so nothing in ci ever ran them on
windows.
The converter pins its source by the sha256 of the bytes on disk. The test
helper wrote the fixture with
write_textand then hashed the string it hadjust written. On linux those are the same bytes. On windows
write_texttranslates every newline into a carriage return and a newline, so the file
on disk is not the file the pin was taken over, and the script refused its
own fixture.
Write the encoded bytes, and take the pin over the same bytes.
What this is not
The first reading of this was a line ending problem in the checkout, to be
fixed with a
.gitattributesrule over the fixture paths. It is not. Thefixture is built in
tmp_pathat run time, and the real suite is downloadedrather than committed, so no
.gitattributesrule reaches either one. Notest hashes a file that comes out of git.
build_strategy.pywas also notat fault: it already writes its output with
newline="\n".The sentence in
docs/DEVELOPMENT.mdabout scripts being checked out withunix line endings is about the shell scripts, for the wsl route, and
*.sh text eol=lfdelivers that. It reads as though it covers the pythonscripts too, which is what sent the first reading down the wrong path, but
the rule matches the claim and needs no change.
Checks
python -m pytest scripts/testson windows: 215 passed, 52 skippedpython3 -m pytest scripts/tests/test_build_strategy.pyon linux: 26passed, so the change is a no-op there
ruff checkandruff format --checkclean🤖 Generated with Claude Code