我想做的 pytest 将始终涉及短回溯(--tb=short)和报告跳过原因(-rsx)
因此,我不需要每次都执行 pytest --tb=short -rsx ,而是可以在某个地方指定它,也许是conftest.py?
谢谢
小智 7
如果您总是想涉及简短的回溯和报告跳过原因,您可以将其写入配置文件pytest.ini
[pytest]
addopts = -rsx --tb=short
Run Code Online (Sandbox Code Playgroud)
或者,您可以设置PYTEST_ADDOPTS环境变量以在使用环境时添加命令行选项:
[pytest]
addopts = -rsx --tb=short
Run Code Online (Sandbox Code Playgroud)