Skip to content

🐛 fix(dotenv): report skipped lines to pytest - #350

Merged
gaborbernat merged 2 commits into
pytest-dev:mainfrom
gaborbernat:fix/pytest-env-dotenv
Nov 19, 2026
Merged

gaborbernat merged 2 commits into
pytest-dev:mainfrom
gaborbernat:fix/pytest-env-dotenv

Conversation

@gaborbernat

@gaborbernat gaborbernat commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

With default capture, pytest hid the warning that python-dotenv had skipped a malformed statement. The warnings summary names the file and line of each skipped statement. Previous behavior. Fixes #345.

The parser supplies the line number

_read_env_file reads each binding once and reports malformed statements through pytest’s configuration warning API. The valid bindings still go through dotenv interpolation and the configured skip rule. Implementation. pytest capture.

Behavior changes

Valid lines in the same file still apply. The diagnostic identifies malformed lines by number and omits their contents.

Reported by OSS Scanner, ANT-2026-UFQWEJSY.

@gaborbernat gaborbernat added the bug Something isn't working label Nov 19, 2026
@gaborbernat
gaborbernat merged commit 01aea0c into pytest-dev:main Nov 19, 2026
19 checks passed
@gaborbernat
gaborbernat deleted the fix/pytest-env-dotenv branch November 23, 2026 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Default capture hides warnings about skipped dotenv lines

1 participant