覆盖范围:哪个测试触及了这条线?

到目前为止,Python 二进制文件的覆盖范围:是否执行了一行。

有没有办法让每个 python 代码行得到一个执行这一行的测试列表?

我阅读了覆盖文档,但找不到解决方案。

回答

coverage.py 可以做到这一点,动态上下文

显然,我需要让这个更容易找到。什么会有所帮助?

  • I've added to the docs in two places: https://github.com/nedbat/coveragepy/commit/22fe2eb167a18dda8fd3e14cbf9166a1c7331fb9
  • This answer would be better if it showed how to use the library to perform the action the the question...
  • 'Context' is not intuitive for me, nor is "dynamic context", so I would have the same difficulty as OP. Add a switch “what-test-ran-this-line” to the CLI. It's a feature that many would want, so make it very easy to do

以上是覆盖范围:哪个测试触及了这条线?的全部内容。
THE END
分享
二维码
< <上一篇
下一篇>>