我想为我的测试编写描述性名称,这使得名称很长。
是否可以避免调用测试test_<something>而使用装饰器或其他东西?或者可以通过一些命令行参数来完成?
您可以在 py.test 配置中设置它,例如将所有内容check_*.py视为测试文件并将所有功能视为*_spec测试:
# content of setup.cfg
# can also be defined in in tox.ini or pytest.ini file
[pytest]
python_files=check_*.py
python_functions=*_spec
Run Code Online (Sandbox Code Playgroud)
查看更多信息https://pytest.org/latest/example/pythoncollection.html#change-naming-conventions
| 归档时间: |
|
| 查看次数: |
2101 次 |
| 最近记录: |