pytest.ini 配置教程

[pytest]
;addopts:配置命令行参数,用空格进行分隔
;可执行标记为mark的对应用例,用or表示标记为demo或者smoke的用例都会执行
addopts = -vs  --alluredir=./results/json --clean-alluredir -m "demo or smoke"

;注册 mark 标记
markers =
    demo : marks tests as demo
    smoke: marks tests as smoke
    uat : marks tests as uat
    test : marks tests as test

minversion = 5.0

;测试用例的路径,可自己配置,
;../pytestproject为上一层的pytestproject文件夹
;./testcase为pytest.ini当前目录下的同级文件夹
;改变用例的查找路径规则,当前目录的testcase文件夹
testpaths =./testcase

;模块名的规则,配置测试搜索的模块文件名称
python_files = test*.py

;类名的规则,配置测试搜索的测试类名
python_classes = Test*

;方法名的规则,配置测试搜索的测试函数名
python_functions = test

参考教程 https://blog.csdn.net/Moonlight_16/article/details/122706934

posted @ 2025-08-30 15:14  赏金猎人小熊  阅读(12)  评论(0)    收藏  举报