zoukankan      html  css  js  c++  java
  • pytest命令行选项

    • pytest ***.py 只运行某个文件
    • pytest 运行当前目录下的所有以test_开头,或以_test结尾的的测试函数
    • pytest [dir]/***.py [dir]/***.py 运行指定目录下的某个测试函数
    • pytest [dir] 运行指定目录下的所有测试函数
    • pytest  [dir]/***.py::test_*** 运行单个测试用例
    • pytest --help 显示全部选项
    • pytest --collect-only 给定配置下显示那些用例会运行
    • pytest -k "A or B" --collect-only 筛选用例 (A or B、A and B、A and not B、not A or not B 等)
    • pytest -v -m markA 用例增加装饰器@pytest.mark.markA后,筛选带markA的用例 
    • pytest -x 遇到失败后停止测试
    • pytest --tb=no 关闭错误信息回溯 argument --tb: (choose from 'short', 'no', 'line')
    • pytest --maxfail=2 --tb=no 明确指定失败几次后停止
    • pytest -s(pytest --capture=no) 信息捕获方法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版本及安装目录
    • pytest--setup-show 回溯fixture的执行过程
  • 相关阅读:
    LeetCode120 Triangle
    LeetCode119 Pascal's Triangle II
    LeetCode118 Pascal's Triangle
    LeetCode115 Distinct Subsequences
    LeetCode114 Flatten Binary Tree to Linked List
    LeetCode113 Path Sum II
    LeetCode112 Path Sum
    LeetCode111 Minimum Depth of Binary Tree
    Windows下搭建PHP开发环境-WEB服务器
    如何发布可用于azure的镜像文件
  • 原文地址:https://www.cnblogs.com/nicole-zhang/p/11039714.html
Copyright © 2011-2022 走看看