在尝试计算python项目的覆盖率时,我遇到了以下错误:
nose.plugins.xcover: ERROR: Coverage not available: unable to import coverage module这是我正在运行的命令:
nosetests --verbosity=3 --with-xcoverage --cover-package=mypackage--nocapture --nologcapture --with-xunit --cover-inclusive我不知道为什么我会收到这个错误,我已经安装了coverage包,nosetests有两个插件coverage和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我在Windows 10上使用Python 3.7.0
发布于 2018-08-04 04:12:22
最有可能的情况是,您的pip命令安装在与nosetest不同的Python中。尝试使用python -m pip和python -m nose.main,以便所有内容都来自同一个安装。
https://stackoverflow.com/questions/51670284
复制相似问题