【问题标题】:Nosetests & Combined Coverage鼻测和综合覆盖
【发布时间】:2011-09-08 17:45:00
【问题描述】:

我有很多项目正在以编程方式运行:

nosetest --with-coverage --cover-html-dir=happy-sauce/

问题在于,对于每个项目,coverage 模块都会覆盖 index.html 文件,而不是附加到它。有没有办法生成一个组合的 super-index.html 文件,其中包含我所有项目的结果?

谢谢。

【问题讨论】:

    标签: python unit-testing nose


    【解决方案1】:

    您不能合并 HTML 目录。您可以合并 .coverage 数据文件,但您必须直接使用覆盖率,而不是通过鼻子:

    $ nosetest --with-coverage proj1
    $ mv .coverage .coverage.1
    $ nosetest --with-coverage proj2
    $ mv .coverage .coverage.2
    $ coverage combine
    (combines .coverage.1 and .coverage.2 into a new .coverage)
    $ coverage html --directory=happy-sauce
    

    【讨论】:

    • 我似乎无法让我的nosetest --with-coverage 生成 .coverage 文件,是否有此标志? (鼻子测试版本 1.0.1)
    • 总是在nose执行的文件夹中生成。
    【解决方案2】:

    nosetests --with-coverage -i project1/*.py -i project2/*.py

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-09-10
      • 1970-01-01
      • 2019-06-28
      • 2011-07-26
      • 2023-04-07
      • 1970-01-01
      相关资源
      最近更新 更多