我环顾四周,找不到可以传递的 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
您可以查看文档的这部分,
您应该在
pytest.ini中将
*
设置为 python_functions 来运行所有函数,如下所示:
# "pytest.ini"
[pytest]
python_functions = *
另外,如果你没有在
python_functions
中设置pytest.ini
,如下所示,那么以test
为前缀的函数将按照文档运行:
# "pytest.ini"
[pytest]
# python_functions = *