Repository navigation
Keep pyproject environment settings visible beside native pytest configuration - #260
Merged
Merged
Conversation
…iguration Confidence: high Scope-risk: narrow Tested: Regression fails before fix and passes after; full suite results recorded externally Not-tested: Other operating systems and Python versions
Constraint: The first TOML file containing pytest_env wins even when empty Tested: Four new subprocess regressions fail before fix; full suite 80 passed; five discovery QA cases passed; Ruff clean Confidence: high Scope-risk: narrow
gaborbernat
approved these changes
Sep 8, 2026
Subprocess regressions left the empty-section branch unmeasured, so CI failed its 100% coverage requirement. Run them through pytester's in-process harness and cover hidden files and sibling and parent precedence.
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.
Problem and change
A native pytest.toml containing only [pytest] settings prevents pytest-env from discovering [tool.pytest_env] in the adjacent pyproject.toml. Continue discovery only when the pytest_env section is absent. An explicitly empty section, including env_files = [], still stops discovery and prevents sibling or parent environment settings from being inherited.
Verification
Tested on macOS, Python 3.12.13 and pytest 9.1.1. Other platforms and Python versions were not tested.
AI assistance: OpenAI Codex drafted and checked this change. All reported commands were run locally.