我的 Python 测试套件文件覆盖率什么时候不会达到 100%?
我们使用 Hudson 和coverage.py 来报告测试套件的代码覆盖率。 Hudson 将覆盖率分解为:
- 包
- 文件
- 类
- 行
- 条件
Coverage.py 仅报告测试期间执行/导入的文件的覆盖率,因此它似乎忽略了测试期间未执行的任何文件。是否存在文件未报告 100% 覆盖率的情况?
We are using Hudson and coverage.py to report the code coverage of our test suite. Hudson breaks down coverage into:
- packages
- files
- classes
- lines
- conditionals
Coverage.py only reports coverage on files executed/imported during the tests, and so it seems is oblivious to any files not executed during the tests. Is there ever an instance where files would not report 100% coverage?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
目前,coverage.py 不知道如何查找从未执行的文件并将其报告为未覆盖,但这将在下一个版本中提供。所以现在,文件覆盖率将始终为 100%。这是 Hudson(使用 Cobertura 插件)和coverage.py 不能很好地结合的领域。
Currently, coverage.py doesn't know how to find files that are never executed and report them as not covered, but that will be coming in the next release. So now, the file coverage will always be 100%. This is an area where Hudson (using the Cobertura plugin) and coverage.py don't mesh very well.
Coverage.py 现在(从 3.4 开始)确实可以让您找到完全未执行的文件。有关详细信息,请参阅文档。
Coverage.py now (as of 3.4) does let you find completely unexecuted files. See the docs for details.