美文网首页
Python py文件添加pytest.ini配置运行测试类报

Python py文件添加pytest.ini配置运行测试类报

作者: 乘风破浪的姐姐 | 来源:发表于2022-10-10 10:39 被阅读0次

1.添加pytest.ini文件,如下:

[pytest]
addopts =-vs  --alluredir ./output/report_json --clean-alluredir --reruns 1 --reruns-delay 2 -p no:warnings
#执行目录
testpaths = ./testcase
#执行目录下的文件
python_files = test_*.py
#执行测试方法
python_functions = test_*
#执行测试类
python_classes = Test*

2.运行test文件,报错如下:


image.png

解决方法:把pytest.ini文件中的中文全部删除即可
pytest.ini文件,如下:

[pytest]
addopts =-vs  --alluredir ./output/report_json --clean-alluredir --reruns 1 --reruns-delay 2 -p no:warnings
testpaths = ./testcase
python_files = test_*.py
python_functions = test_*
python_classes = Test*

相关文章

网友评论

      本文标题:Python py文件添加pytest.ini配置运行测试类报

      本文链接:https://www.haomeiwen.com/subject/fvshwrtx.html