【问题标题】:How to remove environment table in the pytest-html report如何在 pytest-html 报告中删除环境表
【发布时间】:2018-06-05 12:15:24
【问题描述】:

我正在尝试删除 pytest-html 报告中存在的环境表,但我不知道该怎么做?

我已附上 pytest-html 报告 enter image description here

【问题讨论】:

    标签: python python-3.x pytest pytest-html


    【解决方案1】:

    relevant spot in the docs 声明:

    Environment 部分由 pytest-metadata 插件提供,可以通过pytest_configure 挂钩访问:

    def pytest_configure(config):
        config._metadata['foo'] = 'bar'
    

    修改config._metadata 将影响呈现的“环境”部分。如果要完全删除,请将元数据设置为None

    # conftest.py
    
    def pytest_configure(config):
        config._metadata = None
    

    【讨论】:

    • 是的,它工作得很好,谢谢@hoefling,但我唯一的问题是它也删除了标题(我的意思是报告标题)
    • 报告标题(报告名称+“报告生成于...”行)不受此影响,仍然存在。
    • 你工作正常谢谢@hoefling,我犯了一些错误
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-04-23
    • 2018-04-05
    • 1970-01-01
    相关资源
    最近更新 更多