从 django_coverage 中排除系统路径

发布于 2024-10-02 08:00:57 字数 539 浏览 2 评论 0原文

我正在使用命令 test_coverage 在项目上运行 django_coverage。它正在工作,但它包含在 /usr/local/lib/python2.6/dist-packages 中的输出和最终计算代码中。我不想了解这些模块的覆盖范围,只想了解我的项目的测试覆盖范围。我在 BitBucket 上的 django_coverage 文档 中看到有一个 COVERAGE_PATH_EXCLUDES,但这似乎仅适用于项目的子目录,而不适用于绝对系统路径。另外,我发现 COVERAGE_MODULE_EXCLUDES 的默认设置是排除其中包含“django”的任何导入,但我仍然得到 /usr/local/lib/python2.6/ 的输出dist-packages/django.

关于如何解决这个问题有什么想法吗?

I'm running django_coverage over a project with the command test_coverage. It's working, but it's including in the output and final calculation code in /usr/local/lib/python2.6/dist-packages. I'm not interested in knowing about the coverage of those modules, only the test coverage for my project. I see in the django_coverage documentation on BitBucket that there is a COVERAGE_PATH_EXCLUDES, but that seems to apply only to subdirectories of the project and not absolute system paths. Also, I see that the default for COVERAGE_MODULE_EXCLUDES is to exclude any imports with "django" in it, but I'm still getting output for /usr/local/lib/python2.6/dist-packages/django.

Any thoughts on how to fix this?

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

和我恋爱吧 2024-10-09 08:00:57

COVERAGE_PATH_EXCLUDES 中是否列出了“django”?我有一个类似的设置(django 1.1.2,python 2.6),在我的测试覆盖率结果中看不到任何 django 包的输出。您可以发布您用于排除的内容吗?

Do you have 'django' listed in COVERAGE_PATH_EXCLUDES? I have a similar setup (django 1.1.2, python 2.6) don't see the output for any django packages in my test coverage results. Can you post what you are using for the excludes?

忆梦 2024-10-09 08:00:57

我没有使用 django,所以我无法确认这一点,但您是否可能修改了原始代码设置文件,而不是按照步骤 3 中所述将设置包含在您自己的设置中(摘自下面的自述文件摘录):

作为 Django 应用安装

  1. 将整个 django_coverage 应用放入您的第三方应用目录中。
  2. 更新您的 settings.INSTALLED_APPS 以包含 django_coverage
  3. 在您自己的设置文件中包含测试覆盖率的特定设置。有关更多详细信息,请参阅 settings.py

I'm not using django so I can't confirm this, but is it possible that you have modified the original code settings file rather than including the settings in your own as it says in step 3 (from the readme excerpt below):

Install as a Django app

  1. Place the entire django_coverage app in your third-party apps directory.
  2. Update your settings.INSTALLED_APPS to include django_coverage.
  3. Include test coverage specific settings in your own settings file. See settings.py for more detail.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文