test(profiles): make profile tests Windows-locale safe - #84024
test(profiles): make profile tests Windows-locale safe#84024nanami7777777 wants to merge 2 commits into
Conversation
monerostar
left a comment
There was a problem hiding this comment.
Native Win11 verification (monerostar)
Could not leave a formal Approve (fork collaborator scope) — review-as-comment with live evidence.
Host: physical Windows 11 build 26200, CPython 3.11.15. This box is a non-UTF-8-locale-safe target (ACP/system ANSI is not guaranteed UTF-8) and does not have Developer Mode, so require_symlinks correctly skips.
SHA reviewed: 19e9bd0044329cbf30329cb869c6d03d73e5fe1b
What this PR gets right
The three stated Windows problems are real and the patch matches existing repo patterns:
- explicit
encoding="utf-8"on fixture reads/writes .batalias filename onwin32(qiaobusi.batvsqiaobusi)@pytest.mark.require_symlinkson the two symlink tests, plusskipif(win32)on the POSIX wrapper script
Live results
pytest tests/hermes_cli/test_profiles.py -o addopts=
→ 2 failed, 45 passed, 3 skipped in 2.36s
Targeted slice (alias_path or wrapper or encoding or symlink or bat):
4 passed, 3 skipped
SKIPPED POSIX wrapper script
SKIPPED require_symlinks ×2 (no admin/Developer Mode)
The .bat alias assertion passed on this host.
Remaining native-Windows failures (pre-existing, not introduced here)
Both red tests are the classic NTFS os.chmod(..., 0o600) no-op (#56923):
FAILED TestCreateProfile::test_seeds_placeholder_env_file
FAILED TestBackfillProfileEnvs::test_copies_default_env_into_envless_profiles
assert 438 == 384 # S_IMODE(0o100666) vs 0o600
chmod 0o600 does not change Win32 mode bits, so st_mode & 0o777 stays 0o666 (438). This PR does not touch those asserts. CI stays green because Linux runners enforce POSIX modes.
Non-blocking suggestion: guard the two == 0o600 checks with sys.platform != "win32" (same pattern as #56946), or this file will keep failing for native Windows contributors even after the locale/symlink fixes.
CI on the PR is green (All required checks pass). The Windows-contributor path is improved; the chmod asserts are the leftover red.
|
Thanks for the native Win11 verification and the detailed split between PR-caused and pre-existing failures. I pushed f6e597c to guard the two POSIX mode-bit assertions on win32 while keeping the file existence/content checks intact. Validated locally:
|
test(profiles): make profile tests Windows-locale safe
|
Summary
.batwrapper filename wherelist_profiles()reports alias pathsrequire_symlinksmarker so Windows hosts without Developer Mode/admin symlink rights skip cleanlyFixes #83938.
Tests
scripts/run_tests.sh tests/hermes_cli/test_profiles.py.venv/bin/python -m ruff check tests/hermes_cli/test_profiles.py