我们需要清理nosetest .coverage 文件吗?

发布于 2025-01-16 06:49:05 字数 517 浏览 5 评论 0原文

在我看来,我们需要清理由nosetest创建的.coverage隐藏文件,否则当我尝试第二次运行它时,nosetest会感到困惑。它可能会返回 .coverage 文件中的缓存结果。

我这么说的原因是我运行了nosetests --with-coverage --cover-package=.。它创建.coverage。然后我修改我的单元测试(例如删除整个测试),然后重新运行nosetest。我预计覆盖范围会下降,但事实并非如此。这似乎是错误的。

接下来,我删除 .coverage 隐藏文件。再次重新运行nosetest,我发现覆盖率确实下降了。

那么,我需要删除 .coverage 文件吗?

是否有清理 .coverage 文件的标准程序?只需拨打 rm 即可?或者有更正确的方法吗?或者有没有办法运行nosetest,以便强制重新测试而不是读取.coverage 文件?

It seems to me that we need to clean up the .coverage hidden files created by nosetest or else nosetest would be confused when I try to run it a second time. It may return cached results in the .coverage file.

The reason I say that is I run nosetests --with-coverage --cover-package=.. It creates .coverage. Then I modify my unittests (e.g. remove an entire test), and I rerun nosetest. I expect the coverage to go down, but it doesn't. That seems wrong.

Next, I remove the .coverage hidden file. Rerun nosetest again, and I see that coverage did go down.

So, do I need to remove .coverage files?

Is there a standard procedure to clean up the .coverage files? Just call rm? Or is there a more correct way? Or is there a way to run nosetest so that it forces a retest instead of reading the .coverage files?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文