pytest --help 显示全部选项
pytest --collect-only 给定配置下显示那些用例会运行
pytest -k “asdict or defaults” --collect-only 筛选用例
pytest -k “关键字” 说明:执行用例包含“关键字”的用例
pytest -x 遇到失败后停止测试
pytest --tb=no 关闭错误信息回溯argument --tb: (choose from ‘short’, ‘no’, ‘line’)
pytest --maxfail=2 --tb=no 明确指定失败几次后停止
pytest -s(pytest --capture=no) 信息捕获方法 ,就是打印print函数
pytest --capture=sys和pytest --capture=fd
pytest -l(pytest --showlocals) 避免一些不必要的print语句
pytest -lf --tb=no 定位到最后一个失败的用例
pytest -ff --tb=no 定位到第一个失败的用例,ff会运行完剩余的用例
pytest -v --ff --tb=no 每个用例占一行(之前是每个文件占一行)
pytest -q 简化输出信息 pytest -l 打印本地变量
pytest --duration=3 显示耗时最长的三个阶段
pytest --version 查看pytest版本及安装目录