Skip to content

Commit 559c99a

Browse files
committed
fix(ci): pop PYTHONHOME in nox before running pytest to fix Windows CI
On Windows, uv run sets PYTHONHOME to the managed Python 3.14 install directory when starting nox. This leaks into nox sub-sessions so pytest processes for Python 3.11–3.13 load Python 3.14's stdlib and crash. Fix by clearing PYTHONHOME in os.environ at the start of _run_test_suite in noxfile.py, before any pytest subprocess is spawned. Also removes the now-unnecessary `unset PYTHONHOME` from the composite action (it was a no-op: uv run re-injects PYTHONHOME regardless).
1 parent a2fd65f commit 559c99a

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

noxfile.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -893,6 +893,12 @@ def _run_test_suite(session: nox.Session, marker: str = "", cov_append: bool = F
893893
marker: Pytest marker expression
894894
cov_append: Whether to append to existing coverage data
895895
"""
896+
# On Windows, uv run sets PYTHONHOME to the managed Python 3.14 install dir when it
897+
# starts nox. This leaks into pytest sub-processes for older Python versions (3.11-3.13)
898+
# and causes them to load Python 3.14's stdlib, crashing at startup. Clear it here so
899+
# all pytest sub-processes inherit a clean environment. No-op on Linux/macOS where uv
900+
# does not set PYTHONHOME.
901+
os.environ.pop("PYTHONHOME", None)
896902
_setup_venv(session)
897903

898904
posargs = session.posargs[:]

0 commit comments

Comments
 (0)