避免使用" test _"来启动测试名称在pytest?

时间:2015-05-11 07:00:06

标签: python pytest

我想为我的测试编写描述性名称,这使名称变长。

是否可以避免必须调用测试test_<something>而是使用装饰器或其他东西?或者这可以通过一些命令行参数来完成吗?

1 个答案:

答案 0 :(得分:2)

你可以在py.test配置中设置它,例如将所有var resultat = _context.ODVCompteurs.Where( odv => odv.SiteId == siteId && odv.DateODV >= firstDayOfMonth && odv.DateODV < lastDayOfMonth).Sum(x => x.NbrEntree); return resultat; 视为测试文件,将所有函数视为check_*.py作为测试:

*_spec

https://pytest.org/latest/example/pythoncollection.html#change-naming-conventions

了解详情