Skip to content

fix(test): resolve the temp root so test_mirror_plan passes on macOS (dev is red) - #735

Merged
JustVugg merged 1 commit into
devfrom
fix/mirror-plan-test-macos
Jul 31, 2026
Merged

fix(test): resolve the temp root so test_mirror_plan passes on macOS (dev is red)#735
JustVugg merged 1 commit into
devfrom
fix/mirror-plan-test-macos

Conversation

@JustVugg

Copy link
Copy Markdown
Owner

dev is currently red on macOS only, in the test that arrived with #536:

AssertionError: PosixPath("/private/var/folders/.../same.safetensors")
            != PosixPath("/var/folders/.../same.safetensors")

Cause

On macOS /var is a symlink to /private/var. tempfile.TemporaryDirectory() hands back /var/folders/..., while mirror_plan.py resolves every path it is given — discover_shards (line 115) and create_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-onlymirror_plan.py is not touched.

Verification

Reproduced the macOS condition on Linux by creating a symlinked temp directory and running discover_shards through it:

  tool returns    : /tmp/real_xxx/model/a.safetensors
  old comparison  : /tmp/real_xxx_link/model/a.safetensors  -> FAILS
  new comparison  : /tmp/real_xxx/model/a.safetensors       -> PASSES

Plus the suite itself: 8 passed.

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>
@JustVugg
JustVugg merged commit 41b838a into dev Jul 31, 2026
10 checks passed
@JustVugg
JustVugg deleted the fix/mirror-plan-test-macos branch July 31, 2026 23:45
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