Skip to content

Propagate limited useful env. vars. in test_native_env_files_override_ini - #275

Merged
gaborbernat merged 4 commits into
pytest-dev:mainfrom
musicinmybrain:test-pythonpath
Oct 18, 2026
Merged

gaborbernat merged 4 commits into
pytest-dev:mainfrom
musicinmybrain:test-pythonpath

Conversation

@musicinmybrain

Copy link
Copy Markdown
Contributor

In test_native_env_files_override_ini, propagate two useful environment variable into the “clean” environment used for the subprocess to improve compatibility with downstream testing, e.g. in Fedora’s python-pytest-env package. Keeping PYTHONPATH allows the test to work in cases where the PYTHONPATH is needed for pytest to find the pytest_env plugin, and PYTHONDONTWRITEBYTECODE is useful when there’s a desire not to leave stray .pyc files around.

This allows the test to work in environments where `PYTHONPATH` is
needed to find the `pytest_env` plugin, such as downstream in Fedora.
This is useful for downstream testing where it may be desirable not to
leave `.pyc` files lying around.
Assert that Python import and bytecode settings reach the child process.
Keep Windows system paths so a clean environment can start Python.
@gaborbernat
gaborbernat enabled auto-merge (squash) October 18, 2026 16:28
@gaborbernat
gaborbernat merged commit 9a6efe0 into pytest-dev:main Oct 18, 2026
10 checks passed
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.

2 participants