✨ feat(plugin): add --pytest-env-verbose for debugging env assignments#199
Merged
gaborbernat merged 1 commit intopytest-dev:mainfrom Feb 17, 2026
Merged
✨ feat(plugin): add --pytest-env-verbose for debugging env assignments#199gaborbernat merged 1 commit intopytest-dev:mainfrom
gaborbernat merged 1 commit intopytest-dev:mainfrom
Conversation
When multiple env files, inline config, and CLI options interact it becomes hard to track which values pytest-env actually sets. The new flag prints each action (SET, SKIP, UNSET) with source file in the session header via pytest_report_header, following pytest conventions. Also replaces prettier with mdformat (+ toc/gfm/config plugins) and yamlfmt in pre-commit, and restructures the README for readability while keeping the Diataxis layout.
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.
When multiple env files, inline config, CLI
--envfileoptions, and exported variables all interact, tracking what pytest-env actually sets becomes painful. This is especially true after the recent addition of.envfile loading and the--envfileCLI option, which significantly increased the number of possible sources. Closes #198.The new
--pytest-env-verboseflag prints every environment variable action (SET, SKIP, UNSET) along with its source file in the test session header viapytest_report_header, following the same pattern pytest's owncacheprovideruses. This avoids theget_terminal_writer()assertion error that occurs during early hooks and integrates cleanly with pytest's output capturing.Example run with a
pyproject.tomlconfig, a.envfile, andTEMP_VARexported in the shell:This PR also replaces
prettierwithmdformat(withmdformat-toc,mdformat-gfm, andmdformat-configplugins) andyamlfmtin pre-commit, and restructures the README for readability within the existing Diataxis layout -- grouping CLI options together, consolidating small how-to guides, and adding an auto-generated table of contents.