Skip to content

🧪 test: keep inherited PYTHONPATH in native env-files test - #290

Merged
gaborbernat merged 1 commit into
pytest-dev:mainfrom
gaborbernat:fix-native-env-pythonpath
Oct 27, 2026
Merged

gaborbernat merged 1 commit into
pytest-dev:mainfrom
gaborbernat:fix-native-env-pythonpath

Conversation

@gaborbernat

Copy link
Copy Markdown
Collaborator

Downstream packagers who run the suite with pytest-env reachable only through PYTHONPATH, as Fedora's python-pytest-env does, saw 12 test_native_env_files_override_ini cases fail after #275, as reported there. 🐧 Those cases now pass in that setup, so packagers don't need to skip them.

The unset scenarios emptied the environment before copying the caller's PYTHONPATH and PYTHONDONTWRITEBYTECODE, so the pytest subprocess could no longer import the plugin. The test now always forwards the caller's values and adds its marker path only in the set scenarios, which keeps the check that the subprocess inherits them.

The unset scenarios cleared os.environ before copying PYTHONPATH and
PYTHONDONTWRITEBYTECODE, so the subprocess lost both. Downstream builds that
find pytest_env only through PYTHONPATH failed 12 cases, as reported in
pytest-dev#275 (comment).
Pass the caller's values through and add the marker only in the set scenarios.
@gaborbernat gaborbernat added the skip news PR does not need a changelog entry label Oct 27, 2026
@gaborbernat
gaborbernat merged commit eb9c403 into pytest-dev:main Oct 27, 2026
15 of 16 checks passed
@musicinmybrain

Copy link
Copy Markdown
Contributor

Thank you! This indeed resolves #275 (comment), which is very helpful and much appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip news PR does not need a changelog entry

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants