错误:无法使用覆盖模块导入覆盖率

2024-10-06 11:42:36 发布

您现在位置:Python中文网/ 问答频道 /正文

当我试图计算python项目的覆盖率时,遇到了以下错误:

nose.plugins.xcover: ERROR: Coverage not available: unable to import coverage module

这是我正在运行的命令:

^{pr2}$

我不知道为什么会出错,我安装了coverage包,nosetests有两个插件覆盖率和xcoverage。在

这是pip freeze的输出:

certifi==2018.4.16
chardet==3.0.4
coverage==4.5.1
fasteners==0.14.1
idna==2.7
jenkins-job-builder==2.2.1
jenkinsapi==0.3.6
Jinja2==2.10
MarkupSafe==1.0
monotonic==1.5
multi-key-dict==2.0.3
nose==1.3.7
nosexcover==1.0.11
pbr==4.2.0
psutil==5.4.6
python-jenkins==1.1.0
pytz==2018.5
PyYAML==3.13
requests==2.19.1
six==1.11.0
stevedore==1.29.0
tornado==5.1
urllib3==1.23
websocket-client==0.48.0

以及nosetests --plugins的输出:

Plugin capture
Plugin failuredetail
Plugin xunit
Plugin deprecated
Plugin skip
Plugin multiprocess
Plugin logcapture
Plugin xcoverage
Plugin coverage
Plugin attributeselector
Plugin doctest
Plugin profile
Plugin id
Plugin allmodules
Plugin collect-only
Plugin isolation
Plugin pdb

我在Windows10上使用Python3.7.0


Tags: 项目错误coverage覆盖率notpluginserrornosetests