兰州建设局网站,泰安齐鲁人才网,wordpress面包屑导航代码,优质的杭州网站优化pytest_collection_modifyitem在收集完用例后执行#xff0c;通过此hooks#xff0c;在conftest.py中可以实现对用例的过滤和重新排序
根据用例标记和执行参数标记用例是否跳过( --headless运行时#xff0c;并且标记only_headed的用例跳过#xff09;
def pytest_collec…pytest_collection_modifyitem在收集完用例后执行通过此hooks在conftest.py中可以实现对用例的过滤和重新排序
根据用例标记和执行参数标记用例是否跳过( --headless运行时并且标记only_headed的用例跳过
def pytest_collection_modifyitems(config, items):skip the only_headed test case, if run in headless modeonly_headed config.getoption(--headed)skip_headed_parameters pytest.mark.skip(reasononly run in headed mode)for item in items: # only skip the test which mark.only_headedif not only_headed and only_headed in item.keywords:item.add_marker(skip_headed_parameters)根据用例动态的批量添加标记
def pytest_collection_modifyitems(items):for item in items:if interface in item.nodeid: #用例nodeid中包含interface时标记interfaceitem.add_marker(pytest.mark.interface)elif event in item.nodeid: #用例nodeid中包含event时标记eventitem.add_marker(pytest.mark.event)