fix(tests): wrap Path.expanduser() to never raise on Windows runner#1276
Merged
Conversation
Companion to #1272. After the Path.home() override landed, the windows-2025-vs2026 runner still red-marked two tests: tests/unit/install/test_user_scope_rejection_reason.py ::test_user_scope_accepts_tilde_local_path[~/pkg] ::test_user_scope_accepts_tilde_local_path[~/sub/pkg] These hit a different code path: production code in install.package_resolution.user_scope_rejection_reason calls Path('~/pkg').expanduser() to detect that the path is absolute. ntpath.expanduser raises RuntimeError('Could not determine home directory.') when both USERPROFILE and HOMEPATH are absent -- exactly the windows-2025-vs2026 worker env state. Fix in tests/conftest.py (root, loaded by every xdist worker before any test): - Wrap Path.expanduser. On RuntimeError, fall back to _TMP_HOME (the same hermetic dir Path.home() uses). The expanded path is still absolute, so production code's .is_absolute() check keeps behaving correctly. Regression trap added in tests/unit/test_path_home_override.py: clears HOME/USERPROFILE/HOMEDRIVE/HOMEPATH and asserts Path('~/pkg').expanduser() returns an absolute path without raising. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
danielmeppiel
pushed a commit
that referenced
this pull request
May 18, 2026
- One concise line per PR answering 'so what?' for end users - Add 5 missing entries: #1376 (perf resolver), #1373 (shared/apm.md matrix secret-stripping), #1246 (install.ps1 GHES env vars), #1255 (warn missing apm.yml), #1248 (extends:org unmanaged_files) - Drop internal/CI/test-infra entries (#1270, #1271, #1272, #1274, #1276, #1291, #1360 refactor) - Consolidate three #605 lines and four #1317 lines into one entry per PR where appropriate - Promote MCP Registry v0.1 to a dedicated Breaking section Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
danielmeppiel
added a commit
that referenced
this pull request
May 18, 2026
* chore: cut 0.14.0 Renames the [Unreleased] block in CHANGELOG.md to [0.14.0] - 2026-05-18 and bumps the package version from 0.13.0 to 0.14.0 in pyproject.toml (and uv.lock by regeneration). 0.14.0 ships the producer-experience epic (#1348) on the CLI side -- notably: - apm pack --check-versions / --check-clean (#1365), the release gates consumed by apm-action mode: release. - apm plugin init (#1370), the noun-verb successor to apm init --plugin. - apm pack multi-format outputs (--marketplace, --marketplace-path, --json, marketplace.outputs map form) (#1317). - New producer docs corpus (repo-shapes / releasing-from-any-ci / versioning-strategies) (#1370). - Breaking: MCP registry client adopts the official v0.1 spec; self- hosted registries must serve /v0.1/ paths (#1337). Plus the deprecations and fixes already listed in the moved block. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * docs(changelog): tighten v0.14.0 entries; add post-cut PRs - One concise line per PR answering 'so what?' for end users - Add 5 missing entries: #1376 (perf resolver), #1373 (shared/apm.md matrix secret-stripping), #1246 (install.ps1 GHES env vars), #1255 (warn missing apm.yml), #1248 (extends:org unmanaged_files) - Drop internal/CI/test-infra entries (#1270, #1271, #1272, #1274, #1276, #1291, #1360 refactor) - Consolidate three #605 lines and four #1317 lines into one entry per PR where appropriate - Promote MCP Registry v0.1 to a dedicated Breaking section Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * docs(changelog): add #1377 Bitbucket DC tilde fix Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Daniel Meppiel <copilot-rework@github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
sergio-sisternes-epam
pushed a commit
that referenced
this pull request
May 19, 2026
…1276) * fix(tests): wrap Path.expanduser() to never raise on Windows runner Companion to #1272. After the Path.home() override landed, the windows-2025-vs2026 runner still red-marked two tests: tests/unit/install/test_user_scope_rejection_reason.py ::test_user_scope_accepts_tilde_local_path[~/pkg] ::test_user_scope_accepts_tilde_local_path[~/sub/pkg] These hit a different code path: production code in install.package_resolution.user_scope_rejection_reason calls Path('~/pkg').expanduser() to detect that the path is absolute. ntpath.expanduser raises RuntimeError('Could not determine home directory.') when both USERPROFILE and HOMEPATH are absent -- exactly the windows-2025-vs2026 worker env state. Fix in tests/conftest.py (root, loaded by every xdist worker before any test): - Wrap Path.expanduser. On RuntimeError, fall back to _TMP_HOME (the same hermetic dir Path.home() uses). The expanded path is still absolute, so production code's .is_absolute() check keeps behaving correctly. Regression trap added in tests/unit/test_path_home_override.py: clears HOME/USERPROFILE/HOMEDRIVE/HOMEPATH and asserts Path('~/pkg').expanduser() returns an absolute path without raising. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chore: correct PR number in CHANGELOG entry Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Daniel Meppiel <copilot-rework@github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
sergio-sisternes-epam
pushed a commit
that referenced
this pull request
May 19, 2026
* chore: cut 0.14.0 Renames the [Unreleased] block in CHANGELOG.md to [0.14.0] - 2026-05-18 and bumps the package version from 0.13.0 to 0.14.0 in pyproject.toml (and uv.lock by regeneration). 0.14.0 ships the producer-experience epic (#1348) on the CLI side -- notably: - apm pack --check-versions / --check-clean (#1365), the release gates consumed by apm-action mode: release. - apm plugin init (#1370), the noun-verb successor to apm init --plugin. - apm pack multi-format outputs (--marketplace, --marketplace-path, --json, marketplace.outputs map form) (#1317). - New producer docs corpus (repo-shapes / releasing-from-any-ci / versioning-strategies) (#1370). - Breaking: MCP registry client adopts the official v0.1 spec; self- hosted registries must serve /v0.1/ paths (#1337). Plus the deprecations and fixes already listed in the moved block. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * docs(changelog): tighten v0.14.0 entries; add post-cut PRs - One concise line per PR answering 'so what?' for end users - Add 5 missing entries: #1376 (perf resolver), #1373 (shared/apm.md matrix secret-stripping), #1246 (install.ps1 GHES env vars), #1255 (warn missing apm.yml), #1248 (extends:org unmanaged_files) - Drop internal/CI/test-infra entries (#1270, #1271, #1272, #1274, #1276, #1291, #1360 refactor) - Consolidate three #605 lines and four #1317 lines into one entry per PR where appropriate - Promote MCP Registry v0.1 to a dedicated Breaking section Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * docs(changelog): add #1377 Bitbucket DC tilde fix Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Daniel Meppiel <copilot-rework@github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
The v0.13.0 retag CI still red-marked Windows on two tests after #1272:
Different code path than #1272: production code in
install.package_resolution.user_scope_rejection_reasoncallsPath('~/pkg').expanduser()to detect absoluteness.ntpath.expanduserraisesRuntimeErrorwhen bothUSERPROFILEandHOMEPATHare absent — the windows-2025-vs2026 runner state.Fix
tests/conftest.py(root, loaded by every xdist worker before any test): wrapPath.expanduser. OnRuntimeError, fall back to_TMP_HOME(the same hermetic dirPath.home()uses). Expanded path is still absolute so production code's.is_absolute()check still behaves correctly.Validation
tests/unit/test_path_home_override.py(clears HOME/USERPROFILE/HOMEDRIVE/HOMEPATH, assertsPath('~/pkg').expanduser()returns an absolute path without raising).Why ship now
Required for v0.13.0 retag to go green on Windows.