Skip to content

fix(ci): prevent PYTHONHOME leak in Windows nox sub-sessions#559

Merged
olivermeyer merged 1 commit into
mainfrom
fix/window-tests
Apr 23, 2026
Merged

fix(ci): prevent PYTHONHOME leak in Windows nox sub-sessions#559
olivermeyer merged 1 commit into
mainfrom
fix/window-tests

Conversation

@olivermeyer

@olivermeyer olivermeyer commented Apr 22, 2026

Copy link
Copy Markdown
Collaborator

Why?
Windows CI fails for Python 3.11, 3.12, and 3.13 because uv run sets PYTHONHOME to the managed Python 3.14 install directory when launching nox. This leaks into pytest sub-processes for older Python versions, causing them to load 3.14's stdlib and crash at startup (SyntaxError on 3.11; fatal init_import_site on 3.12/3.13).

How?
On Windows only, strip PYTHONHOME from the session's subprocess environment in _run_test_suite before any pytest process is spawned. The fix is guarded by platform.system() == "Windows" to avoid affecting coverage collection on Linux/macOS.

Copilot AI review requested due to automatic review settings April 22, 2026 14:59
@olivermeyer olivermeyer requested a review from a team as a code owner April 22, 2026 14:59
@olivermeyer olivermeyer added the skip:test:long_running Skip long-running tests (≥5min) label Apr 22, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the Windows CI test runner composite action to prevent PYTHONHOME (set by uv run for Python 3.14) from leaking into nox sub-sessions running other Python versions.

Changes:

  • Unsets PYTHONHOME immediately before executing make $MAKE_TARGET in the run-tests composite action.

@codecov

This comment was marked as outdated.

Copilot AI review requested due to automatic review settings April 23, 2026 06:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comment thread noxfile.py Outdated
Copilot AI review requested due to automatic review settings April 23, 2026 08:24
@olivermeyer olivermeyer changed the title fix(ci): unset PYTHONHOME before running nox tests on Windows fix(ci): strip PYTHONHOME via session.env for Windows nox tests Apr 23, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 4 comments.

Comment thread noxfile.py Outdated
Comment thread noxfile.py Outdated
Comment thread noxfile.py
Comment thread noxfile.py Outdated
@olivermeyer olivermeyer removed the skip:test:long_running Skip long-running tests (≥5min) label Apr 23, 2026
…dows

On Windows, uv run sets PYTHONHOME to the managed Python 3.14 install
directory. This leaks into nox sub-sessions for older Python versions
(3.11-3.13), causing them to load 3.14's stdlib and crash at startup.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@olivermeyer olivermeyer changed the title fix(ci): strip PYTHONHOME via session.env for Windows nox tests fix(ci): prevent PYTHONHOME leak in Windows nox sub-sessions Apr 23, 2026
@sonarqubecloud

Copy link
Copy Markdown

@olivermeyer olivermeyer merged commit adb1fa0 into main Apr 23, 2026
28 checks passed
@olivermeyer olivermeyer deleted the fix/window-tests branch April 23, 2026 10:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants