我想使用以下代码修改 pytest 报告的结果表的列:
from datetime import datetime
from py.xml import html
import pytest
@pytest.mark.optionalhook
def pytest_html_results_table_header(cells):
cells.insert(2, html.th('Description'))
cells.insert(1, html.th('Time', class_='sortable time', col='time'))
cells.pop()
@pytest.mark.optionalhook
def pytest_html_results_table_row(report, cells):
cells.insert(2, html.td(report.description))
cells.insert(1, html.td(datetime.utcnow(), class_='col-time'))
cells.pop()
@pytest.mark.hookwrapper
def pytest_runtest_makereport(item, call):
outcome = yield
report = outcome.get_result()
report.description = str(item.function.__doc__)
要使用上面的代码,我正在尝试安装 py.xml。在使用pip install py.xml
. ,我收到以下错误消息:
找不到满足 py.xml 要求的版本(来自版本:)找不到 py.xml 的匹配分发
请让我知道如何解决此问题