首页 文章

结合python覆盖文件?

提问于
浏览
10

我'm wondering if it'可以将 coverage.xml 文件合并到一个文件中,以查看HTML输出中的全局报告 .

我把 unit/functional tests 作为1命令运行, integration tests 作为第二个命令运行 . 这意味着 unit/functional tests 的覆盖范围被 unit tests 覆盖 .

如果我对这个问题有一些解决方案,那将是很好的,主要是通过将这些文件组合成1个文件 .

2 回答

  • 15

    您无法组合.xml文件,但可以组合原始数据文件 . 您的工作流程如下所示:

    $ COVERAGE_FILE=.coverage_func coverage run the_functional_tests.py
    $ COVERAGE_FILE=.coverage_inte coverage run the_integration_tests.py
    $ coverage combine
    $ coverage xml
    
  • 11

    我找到了另一种解决方案 . 我使用 combine 功能(read here)所以我运行我的报道如: coverage run -p 然后我做 coverage combine .

    就这样 . 它生成1个组合报告 .

相关问题