PytestUnknownMarkWarning: Unknown pytest.mark.pre - is this a typo?
pytest执行遇到提示:
PytestUnknownMarkWarning: Unknown pytest.mark.pre - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/latest/mark.html
@pytest.mark.pre
解决办法:
1、在conftest里面添加代码:
def pytest_configure(config):
marker_list = ["pre","saas","test3"] # 标签名集合
for markers in marker_list:
config.addinivalue_line(
"markers", markers
)
2、还有一种方法:添加pytest.int 配置文件
[pytest]
markers = pre
saas
test3