当我试图计算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
您的
pip
命令很可能安装在与nosetest
不同的Python中。尝试使用python -m pip
和python -m nose.main
,这样所有的东西都来自同一个安装。在相关问题 更多 >
编程相关推荐