Skip to content

Document [pytest] env configuration in pytest.toml / .pytest.toml - #262

Merged
gaborbernat merged 1 commit into
pytest-dev:mainfrom
devtechedge:docs-pytest-toml-native-table
Sep 14, 2026
Merged

gaborbernat merged 1 commit into
pytest-dev:mainfrom
devtechedge:docs-pytest-toml-native-table

Conversation

@devtechedge

Copy link
Copy Markdown
Contributor

The README documents the plugin-specific TOML tables ([tool.pytest_env] in pyproject.toml, [pytest_env] in pytest.toml / .pytest.toml) and the INI-style env entries for pytest.ini and pyproject.toml, but it never shows that pytest.toml / .pytest.toml can also carry the pytest-native [pytest] table with env = [...]. Without that example, users can conclude that pytest.toml must use the [pytest_env] table.

This adds the missing example to the INI configuration format section, beside the existing pytest.ini and pyproject.toml forms, plus a short note on how it relates to the [pytest_env] table. I verified the documented behavior locally: with pytest and pytest-env installed, a pytest.toml containing the [pytest] table shown in the README sets the listed variables (confirmed with a passing assertion on os.environ).

Fixes #261

@gaborbernat
gaborbernat enabled auto-merge (squash) September 14, 2026 13:56
@gaborbernat
gaborbernat merged commit e8c1b87 into pytest-dev:main Sep 14, 2026
11 checks passed
@devtechedge

Copy link
Copy Markdown
Contributor Author

Thanks for the review and merge, @gaborbernat!

The README already documented [tool.pytest_env] and [pytest_env], plus the INI env entries, but not the native [pytest] table with env = [...] in pytest.toml / .pytest.toml.

That example now sits with the other INI forms so the two tables are not easy to mix up.

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.

Document [pytest] configuration in pytest.toml / .pytest.toml

2 participants