有没有办法在 pytest 生成的 html 报告中包含取消选择的测试,类似于跳过的测试?
- 生成的html文件:file: ////////reports/report.html - ================ 13个通过,41个跳过,6个在35.54s内取消选择== ================
我找到了一个解决方案,通过将其添加到conftest.py将它们打印在终端中
def pytest_deselected(items):
if not items:
return
config = items[0].session.config
reporter = config.pluginmanager.getplugin("terminalreporter")
reporter.ensure_newline()
for item in items:
reporter.line(f"deselected: {item.nodeid}", yellow=True, bold=True)