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

2022-10-10  本文已影响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*
上一篇 下一篇

猜你喜欢

热点阅读