首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >无法找到满足py.xml需求的版本(来自版本:)没有为py.xml找到匹配的发行版

无法找到满足py.xml需求的版本(来自版本:)没有为py.xml找到匹配的发行版
EN

Stack Overflow用户
提问于 2018-07-21 13:34:24
回答 1查看 1.2K关注 0票数 1

我希望使用以下代码修改pytest报告结果表的列:

代码语言:javascript
运行
复制
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找到匹配的发行版

请告诉我如何解决这个问题。

EN

回答 1

Stack Overflow用户

发布于 2018-07-21 13:42:01

如果您正在寻找pylib xml模块,那么它是由pip install py提供的(通常是pytest的一个传递依赖项,所以您可能已经安装了它)

尽管如此,在逐步淘汰py时,您可能需要考虑使用不同的库:

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

(来自自述)

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/51456603

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档