django-admin startproject testproject > coverage run ./manage.py test Creating test-6ren">
gpt4 book ai didi

python - 使 "coverage report"只显示当前目录中的文件?

转载 作者:太空宇宙 更新时间:2023-11-04 00:57:56 24 4
gpt4 key购买 nike

考虑以下示例:

> django-admin startproject testproject
> coverage run ./manage.py test
Creating test database for alias 'default'...

----------------------------------------------------------------------
Ran 0 tests in 0.000s

OK
Destroying test database for alias 'default'...
> coverage report 2>&1 | head -n 20
Name Stmts Miss Cover
-----------------------------------------------------------------------------------------------------------------------------------------
/home/d/virtualenv/lib/python2.7/site-packages/django/__init__ 9 0 100%
/home/d/virtualenv/lib/python2.7/site-packages/django/apps/__init__ 2 0 100%
/home/d/virtualenv/lib/python2.7/site-packages/django/apps/config 84 23 73%
/home/d/virtualenv/lib/python2.7/site-packages/django/apps/registry 186 75 60%
/home/d/virtualenv/lib/python2.7/site-packages/django/conf/__init__ 87 29 67%
/home/d/virtualenv/lib/python2.7/site-packages/django/conf/global_settings 136 0 100%
/home/d/virtualenv/lib/python2.7/site-packages/django/conf/locale/__init__ 2 0 100%
/home/d/virtualenv/lib/python2.7/site-packages/django/conf/urls/__init__ 48 34 29%
/home/d/virtualenv/lib/python2.7/site-packages/django/contrib/__init__ 0 0 100%
/home/d/virtualenv/lib/python2.7/site-packages/django/contrib/admin/__init__ 10 0 100%
/home/d/virtualenv/lib/python2.7/site-packages/django/contrib/admin/actions 36 26 28%
/home/d/virtualenv/lib/python2.7/site-packages/django/contrib/admin/apps 13 0 100%
/home/d/virtualenv/lib/python2.7/site-packages/django/contrib/admin/checks 401 212 47%
/home/d/virtualenv/lib/python2.7/site-packages/django/contrib/admin/decorators 12 11 8%
/home/d/virtualenv/lib/python2.7/site-packages/django/contrib/admin/exceptions 5 0 100%
/home/d/virtualenv/lib/python2.7/site-packages/django/contrib/admin/filters 197 132 33%
/home/d/virtualenv/lib/python2.7/site-packages/django/contrib/admin/helpers 225 161 28%
/home/d/virtualenv/lib/python2.7/site-packages/django/contrib/admin/migrations/0001_initial 7 0 100%

如何使“覆盖率报告”只报告当前目录中的文件,即项目文件?

最佳答案

尝试使用 --source=.,或 .coveragerc 文件中的等效项。

关于python - 使 "coverage report"只显示当前目录中的文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34226573/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com