Skip to content

Fix verbose source attribution when falling back to INI env#211

Merged
gaborbernat merged 1 commit intopytest-dev:mainfrom
shuofengzhang:fix-verbose-source-ini-fallback
Mar 12, 2026
Merged

Fix verbose source attribution when falling back to INI env#211
gaborbernat merged 1 commit intopytest-dev:mainfrom
shuofengzhang:fix-verbose-source-ini-fallback

Conversation

@shuofengzhang
Copy link
Contributor

What changed

  • Fixed verbose source attribution so --pytest-env-verbose reports the INI file when env entries come from INI fallback.
  • Added a regression test for the case where a pyproject.toml exists but does not contain a pytest_env section.
  • Tightened the existing INI verbose test to assert the reported source path.

Why

  • Previously, if a TOML file was discovered but had no pytest_env entries, verbose output still labeled inline env assignments as coming from that TOML file.
  • This made debug output misleading for projects that keep build metadata in pyproject.toml while configuring env in pytest.ini.

Testing

  • . .venv/bin/activate && pytest (71 passed)

@gaborbernat gaborbernat merged commit 81f9e0e into pytest-dev:main Mar 12, 2026
9 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