test(windows): skipif POSIX-only pwd.getpwuid simulation in fastembed_cache (#643)#721
Merged
test(windows): skipif POSIX-only pwd.getpwuid simulation in fastembed_cache (#643)#721
Conversation
…_cache (#643) `test_unexpandable_home_raises_actionable_error` simulates the POSIX- specific failure mode where `$HOME` is unset AND `pwd.getpwuid()` raises `KeyError`, causing `Path.expanduser()` to fail with `RuntimeError`. The test imports `pwd` and monkeypatches `pwd.getpwuid` — both POSIX-only. On Windows there is no `pwd` module; expanduser uses USERPROFILE / HOMEDRIVE+HOMEPATH instead of pwent, so the failure mode under test does not exist on Windows. Mirrors PR #713's pattern for POSIX-only assertions. Same `@pytest.mark.skipif(sys.platform == "win32", ...)` form already used across `test_server_*.py` (5 sites). Adds one stdlib import (`sys`) since the file did not already use it. Co-Authored-By: Claude <[email protected]>
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Summary
/vs\\) #643 Windows sweep:test_unexpandable_home_raises_actionable_errorfailed on Windows withModuleNotFoundError: No module named 'pwd'because the test importspwdand monkeypatchespwd.getpwuidto simulate a POSIX-specific expanduser failure mode.pwdmodule;Path.expanduser()falls back toUSERPROFILE/HOMEDRIVE+HOMEPATHenv vars rather than pwent. The simulated failure mode does not exist on Windows, soskipifis the right call (not "rewrite for Windows").@pytest.mark.skipif(sys.platform == "win32", reason="server is POSIX-only")form already used at 5 sites intest_server_*.py.Diff
+6 / -0— addsimport sys(file didn't use it) and the skipif decorator with a reason that names the specific POSIX dependency.Test plan
uv run pytest packages/memtomem/tests/test_fastembed_cache.py— 6/6 pass (skipif inactive on POSIX, original test still runs).ruff check+ruff format --checkclean.Out of scope
The other 27 Windows failures from the previous run cluster into ~7 separate root causes (dirty-state misclassification, memory_dir prefix matching, claude-projects scope, mm.exe binary path, tilde expansion, init_cmd POSIX assumptions, misc) — each will get its own PR per
feedback_one_change_per_pr.md. Cluster B (memory_dir prefix) is intentionally skipped here as parallel work is in flight onfix/647-windows-memory-dir-prefix.🤖 Generated with Claude Code