pyproject 示例
pyproject 示例
[tool.pytest.ini_options]
testpaths = ["tests"]
addopts = "-q -ra --strict-markers"
markers = [
"smoke: 冒烟集合",
"slow: 慢用例",
]
filterwarnings = ["error"]把约定参数(-ra、--strict-markers)放进 addopts,让本地与 CI 行为一致。
pytest 配置集中在 pytest.ini、pyproject.toml 的 [tool.pytest.ini_options] 或 tox.ini;常用项包括 testpaths、addopts、markers、filterwarnings 与日志设置。
[tool.pytest.ini_options]
testpaths = ["tests"]
addopts = "-q -ra --strict-markers"
markers = [
"smoke: 冒烟集合",
"slow: 慢用例",
]
filterwarnings = ["error"]