使用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'"
)