Native TOML Configuration

pytest 9.0 natively supports configuration in pyproject.toml via the [tool.pytest.ini_options] section. This approach replaces pytest.ini and setup.cfg by centralizing project configuration.

Configuration Example

toml
# pyproject.toml
[tool.pytest.ini_options]
minversion = "9.0"
addopts = "-ra -q --strict-markers"
testpaths = ["tests"]
markers = [
    "slow: slow tests (disabled by default)",
    "integration: integration tests",
]
filterwarnings = [
    "error",
    "ignore::DeprecationWarning",
]

Compared to pytest.ini, TOML offers native typing (lists, booleans) and lets you consolidate all project configuration in a single file.

Sources