pytest--用例执行

pytest退出执行:

一,用例失败后退出执行

pytest -x                   # 用例失败1个后退出执行

pytest --maxfail=2    # 用例失败2个后退出执行

pytest执行:

pytest          # 执行所有用例

pytest test_test.py     #按模块执行

pytest   testing/        #按包执行

pytest -k    "add"     #按照关键字执行

pytest test_pytest.py::test_add    #模块种的特定的用例

pytest -m slow        #按照标签运行  用例上添加@pytest.mark.slow 装饰器

原文地址:https://www.cnblogs.com/aliy-pan/p/7601513.html