test: set USERPROFILE alongside HOME in tilde-expansion tests - #71425
test: set USERPROFILE alongside HOME in tilde-expansion tests#71425cryptoyasenka wants to merge 1 commit into
Conversation
Native Win11 verification (monerostar)Host: Windows 11 build Ran the four named tilde-expansion tests on current Results
Failure shape on main (expected)
Fix checkSetting Verdict: solid test-only Windows fix; confirmed on live Win11. Evidence only — not a maintainer approve. |
|
Thanks for the focused native-Windows test isolation fix. The premise remains valid on current main: Problems
Suggested changes
Automated hermes-sweeper review. |
ab2eb1b to
a5032c1
Compare
|
@monerostar thank you for running this on a real Win11 box and posting the exact failure shapes. That is far more useful than a green run on my own machine, and it saved me guessing about the CLI cases. Reworked per the review. Rebased onto current main and dropped the two CLI hunks, since What remains is exactly the two fixtures the review asked to retain:
Windows 11 with current main checked out: 2 failed before, 2 passed after. The other two tests monerostar verified are green on main on their own now, so the reduced scope does not lose anything. PR body updated to match the new diff. |
5f216f6 to
de5d89f
Compare
ntpath.expanduser() reads USERPROFILE and ignores HOME, so on Windows these two tests expanded "~" to the real user profile instead of the temporary home they had just set up. Setting both env vars keeps the tests unchanged on POSIX and makes them actually exercise the expansion on Windows. Failures fixed on Windows: tests/agent/lsp/test_workspace.py::test_normalize_path_expands_tilde tests/cron/test_cron_workdir.py::TestNormalizeWorkdir::test_tilde_expands The CLI fixtures this change also touched originally landed on main in 53f7d13, so those hunks are dropped here.
de5d89f to
2570db1
Compare
Two tests set
HOMEto a temporary directory and then assert that~expands into it. On Windowsntpath.expanduser()readsUSERPROFILEand ignoresHOME, so~kept resolving to the real user profile and both failed.Setting both variables leaves POSIX behaviour untouched and lets the tests actually exercise the expansion on Windows instead of asserting against whatever home directory the developer happens to have.
Updated: rebased onto current main and narrowed from four tests to the two that are still affected:
tests/agent/lsp/test_workspace.py::test_normalize_path_expands_tildetests/cron/test_cron_workdir.py::TestNormalizeWorkdir::test_tilde_expandsThe two CLI tests this PR originally touched (
tests/cli/test_cli_file_drop.py,tests/cli/test_cli_image_command.py) already received the same fix on main in 53f7d13, so they are dropped here. That is also what the conflict was about, and it is now gone.Verified on Windows 11, Python 3.13, cherry-picked onto current main:
Linux and macOS are unaffected, since
posixpath.expanduser()prefersHOMEeither way.Green ubuntu run for this head: https://github.com/cryptoyasenka/hermes-agent/actions/runs/31056700675
Test only, no source changes.
ruff checkclean.