Repository navigation
fix: align executable lookup on Windows with other platforms - #964
roger-zhangg wants to merge 2 commits into
Conversation
🧪 Hands-on test: No problems observed in 6 scenariosCommit Scenarios
Runner's notes in full
🤖 Automated hands-on test — not a review approval · model claude-opus-5.5 · Kiro kiro-cli 2.33.1 · build History (4)
|
bnusunny
left a comment
There was a problem hiding this comment.
The code change looks right, but test_returns_absolute_paths fails on every Windows unit job, so CI is red because of this PR. See the inline comment.
| self._create_executable(self.working_dir / "tool") | ||
|
|
||
| with patch.dict(os.environ, {"PATH": str(self.path_dir)}): | ||
| self.assertEqual(which("tool", executable_search_paths=["."]), [os.path.join(os.getcwd(), "tool")]) |
There was a problem hiding this comment.
This fails on Windows: which() only tries tool + each PATHEXT entry there, so an extensionless tool is never found and the result is []. test_ignores_empty_path_entries above has the same problem: on Windows it passes whether or not the empty PATH entry is skipped. Create tool.CMD and patch PATHEXT like test_windows_lookup_uses_only_search_paths does, or mark these two tests as non-Windows.
There was a problem hiding this comment.
Thanks, fixed in 5574e9a. Both tests now create the file name that which() looks for on the current platform: tool.CMD with PATHEXT patched on Windows, and tool elsewhere. On Windows, test_ignores_empty_path_entries now checks the empty entry for real. I confirmed that both tests fail without the change in utils.py, on Linux and with sys.platform set to win32. I also rebased onto the latest develop.
0e806f8 to
5574e9a
Compare
d1afd0e
There was a problem hiding this comment.
🧪 Hands-on test reproduced 1 new problem on commit d1afd0e. Commands and evidence are in the hands-on comment.
- [BUG] Unused 'import shutil' left in python_uv/utils.py makes 'ruff check aws_lambda_builders' fail (F401) · low · aws_lambda_builders/workflows/python_uv/utils.py:8
🤖 Automated hands-on test — not a review approval
which() no longer prepends the working directory to the search path on Windows, ignores empty PATH entries, and returns absolute paths. The Python UV workflow now uses the same lookup. Adds unit tests.
d1afd0e to
bf6d36e
Compare
Issue #, if available:
Description of changes
Align executable lookup on Windows with Linux and macOS:
which()resolves executables only fromPATHand the configured executable search paths; it no longer prepends the working directory on Windows.PATHentries (for example from a trailing separator) are ignored.shutil.which.Project-local tools that are intentionally supported (e.g.
gradlew, a projectesbuild) are unaffected, since they are found via explicit executable search paths.Description of how you validated changes
PATHentries, absolute paths, and the UV workflow lookup.pytest tests/unit tests/functional,ruff check aws_lambda_builders,black --check.Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.