Pytest配置文件声明自定义用例标识

使用pytest.ini添加自定义用例标识:

[pytest]
# 1、使用没有注册过的标记抛出错误
addopts = --strict-markers
# 2、自定义标记
markers =
    smoking: 自定义冒烟用例的标记;执行非冒烟用例 pytest -m "not smoking"

使用conftest.py文件添加自定义用例标识:

def pytest_configure(config):
    config.addinivalue_line(
        "markers", "smoking: 自定义冒烟用例的标记;执行非冒烟用例 pytest -m 'not smoking'"
    )
posted @ 2020-10-10 22:19  拖延症的理想主义者  阅读(235)  评论(0编辑  收藏  举报