繁体   English   中英

我如何让pytest运行所有功能作为测试

[英]How do I get pytest to run all functions as test

我环顾四周,找不到pytest.ini标志传递,该标志表示

def test_one():
   # you run this by default

def two():
   # despite not having test in the name you should also run this

原因:当我使用命名进行描述时,测试功能名称的长度越来越长,坦率地说,它似乎很干燥。

文档

# content of setup.cfg
# can also be defined in in tox.ini or pytest.ini file
[pytest]
python_files=check_*.py
python_classes=Check
python_functions=*_check

替换*_check只有*在那里,你设置。

尝试如下所示,它将要求所有python文件进行py.test集合测试。

# content of pytest.ini
[pytest]
python_files = *.py

您可以检查文档的这一部分,

自定义测试集合以查找所有.py文件

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM