pytest-pytest.main()运行测试用例,pytest参数

本文介绍pytest.main运行测试用例的方法
pytest.main():main中传入不同的指令用以执行指定测试用例
-s: 显示程序中的print/logging输出
-v: 丰富信息模式, 输出更详细的用例执行信息
-q: 安静模式, 不输出环境信息
-k:关键字匹配,用and区分:匹配范围(文件名、类名、函数名)

示例

test_module1.py

test_module2.py

maintest.py

运行结果:

1、运行指定路径下的用例

2、运行参数

运行结果:

运行结果:

运行结果:

运行结果:

转自:https://blog.csdn.net/weixin_44006041/article/details/107934174

原文地址:https://www.cnblogs.com/Loveyinran/p/14211522.html