找不到满足要求py.xml的版本(来自版本:)找不到py.xml的匹配发行版

时间:2018-07-21 13:34:25

标签: pytest pytest-html

我想使用以下代码修改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的匹配发行版

请让我知道如何解决此问题

1 个答案:

答案 0 :(得分:0)

如果要查找pylib xml模块,它由pip install py提供(通常是pytest的可传递依赖项,因此您可能已经安装了它)

也就是说,您可能要考虑使用其他库,因为py即将被淘汰:

  

注意:此库处于维护模式,不应在新代码中使用。

(来自the readme

相关问题