test(windows): use shutil.which for mm entry-point lookup (#643)#723
Merged
test(windows): use shutil.which for mm entry-point lookup (#643)#723
Conversation
`TestFreshNoopIndexSubprocess::test_init_index_search_via_subprocess`
constructed the path to the `mm` script as
`os.path.join(os.path.dirname(sys.executable), "mm")` and then checked
`os.path.exists(mm_bin)`. On Windows the entry point installed by
`uv pip install -e` is `.venv/Scripts/mm.exe`, not `mm` — so the
existence check failed and the test errored out with `mm binary not
found at D:\a\memtomem\memtomem\.venv\Scripts\mm`.
`shutil.which("mm", path=bin_dir)` does the lookup the way Python
itself does it: PATHEXT-aware on Windows (tries `.exe`, `.cmd`, `.bat`),
no-extension on POSIX. The returned path is the full executable path
ready to hand to `subprocess.run`, which is exactly what the test
already does on the next line. The error message changes from "not
found at <path-with-name>" to "not found in <bin_dir>" since the
suffix is now platform-determined.
Cluster F of the #643 sweep — single test, single root cause. Production
code is unchanged.
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 (1 test).TestFreshNoopIndexSubprocess::test_init_index_search_via_subprocesserrored out on Windows withmm binary not found at D:\a\memtomem\memtomem\.venv\Scripts\mmbecause the test built the path with a hardcoded"mm"name andos.path.existscheck. On Windows the uv-installed entry point ismm.exe, notmm.shutil.which("mm", path=bin_dir)— that helper is PATHEXT-aware on Windows (tries.exe,.cmd,.bat) and no-extension on POSIX, returning the platform-correct full path ready to hand tosubprocess.run.Diff
+8 / -3— addsimport shutil, replaces the path construction +os.path.existscheck withshutil.which+is Nonecheck, and updates the error message to say "not found in<bin_dir>" since the binary suffix is now platform-determined.Test plan
uv run pytest packages/memtomem/tests/test_cli_index_noop_e2e.py— 2/2 pass (resolves to.venv/bin/mm).ruff check+ruff format --checkclean..venv\Scripts\mm.exeand run the subprocess.Out of scope
The remaining 26 Windows failures cluster into ~6 separate root causes — each will get its own PR per
feedback_one_change_per_pr.md. Cluster B (memory_dir prefix) intentionally skipped — parallel work in flight onfix/647-windows-memory-dir-prefixandfix/720-source-filter-windows.🤖 Generated with Claude Code