fix(test): resolve the temp root so test_mirror_plan passes on macOS (dev is red) - #735
Merged
Conversation
dev went red on macOS only, in the test added by #536: AssertionError: PosixPath('/private/var/folders/.../same.safetensors') != PosixPath('/var/folders/.../same.safetensors') On macOS /var is a symlink to /private/var, so tempfile hands back /var/folders/... while mirror_plan.py resolves every path it is given (discover_shards line 115, create_plan lines 197-199). The test compared a resolved path returned by the tool against an unresolved one it built itself. Linux has no such symlink, which is why it passed there -- including in my own pre-merge run, which is how this reached dev. Resolving the temp root in setUp makes every derived path resolved, so both sides match on every platform. Test-only; mirror_plan.py is unchanged. Verified by reproducing the macOS condition on Linux with a symlinked temp dir: the old comparison fails against it and the new one passes. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
devis currently red on macOS only, in the test that arrived with #536:Cause
On macOS
/varis a symlink to/private/var.tempfile.TemporaryDirectory()hands back/var/folders/..., whilemirror_plan.pyresolves every path it is given —discover_shards(line 115) andcreate_plan(lines 197–199). The test then compared a resolved path returned by the tool against an unresolved one it had built itself.Linux has no such symlink, so the two are identical there and the test passes — including in the run I did before merging #536, which is how this reached
dev.Fix
Resolve the temp root once in
setUp, so every path derived from it is resolved and both sides of every assertion match on every platform. Test-only —mirror_plan.pyis not touched.Verification
Reproduced the macOS condition on Linux by creating a symlinked temp directory and running
discover_shardsthrough it:Plus the suite itself: 8 passed.