Repository navigation
test: keep existing PYTHONPATH in test_noxfile_script_mode - #1190
Merged
henryiii merged 1 commit intoSep 29, 2026
Merged
Conversation
The test replaced PYTHONPATH with the directory holding the fake nox-999 metadata. When nox is only importable through PYTHONPATH, as in FreeBSD ports, the subprocess then fails with "No module named nox". Prepend the fake package instead so the existing path is kept. Fixes #1189
devtechedge
added a commit
to devtechedge/oss-contributions
that referenced
this pull request
Sep 28, 2026
Contributor
Author
|
I appreciate the fast review and merge, Henry. You approved and merged it within a day, which meant a lot. Reproducing the FreeBSD ports setup with a staged install on PYTHONPATH taught me how the os.chdir side effect hides this failure in a full-file run. It was genuinely fun getting this one across the line! |
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.
test_noxfile_script_modenow prepends the fakenox-999package toPYTHONPATHinstead of replacing it.Fixes #1189
When nox is importable only through
PYTHONPATH, as in FreeBSD ports where the staged install is exposed that way during tests, the replaced value drops nox and the subprocess fails withNo module named nox.The failure only shows up when the whole file runs, because earlier in-process tests leave the working directory at a noxfile directory (via
os.chdirinnox/tasks.py), so the source tree is no longer onsys.patheither.The fake
nox-999metadata stays first on the path, so the test still covers the #1157 behavior.This is a test-only change and
nox/_cli.pyis untouched.To reproduce the ports setup, I made a venv with only the runtime dependencies plus pytest and staged nox with
uv pip install --no-deps --target /tmp/stage ..Before this change:
After this change:
The normal session still passes:
nox -s lintis clean as well.