工作服测试中未提供模块覆盖范围

时间:2015-10-22 09:39:01

标签: python python-2.7 coverage.py coveralls

我试图实施测试代码覆盖率,并且我遇到了工作服问题。为此,请遵循本指南:

https://github.com/coagulant/coveralls-python

我的问题是,当你运行工作服时,系统警告我覆盖模块不可用。

由于该模块不可用,我尝试使用pip安装,我读到了travis-ci的错误,它告诉我已经存在。

我对travis-ci测试本身没有任何问题。他们运行正常。我在after_success部分执行所有工作服代码。

$ pip install coverage 
You are using pip version 6.0.7, however version 7.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Requirement already satisfied (use --upgrade to upgrade): coverage in /home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages

after_success.3 0.11s$ coveralls

Traceback (most recent call last):
  File "/home/travis/virtualenv/python2.7.9/bin/coveralls", line 11, in <module>
    sys.exit(wear())
  File "/home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages/coveralls/__init__.py", line 76, in wear
    from coveralls.control import coveralls
  File "/home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages/coveralls/control.py", line 1, in <module>
    from coverage.control import coverage
ImportError: cannot import name coverage$ pip install coverage
You are using pip version 6.0.7, however version 7.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Requirement already satisfied (use --upgrade to upgrade): coverage in /home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages

after_success.3 0.11s$ coveralls

Traceback (most recent call last):
  File "/home/travis/virtualenv/python2.7.9/bin/coveralls", line 11, in <module>
    sys.exit(wear())
  File "/home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages/coveralls/__init__.py", line 76, in wear
    from coveralls.control import coveralls
  File "/home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages/coveralls/control.py", line 1, in <module>
    from coverage.control import coverage
ImportError: cannot import name coverage

是否有特殊的方法来安装coverage模块?

1 个答案:

答案 0 :(得分:0)

经过更多研究后,我找到了解决方案。

我忘了在安装部分安装模块工作服。

install:
- pip install coveralls

系统报告我:

$ coveralls
Submitting coverage to coveralls.io...
Coverage submitted!

我希望这个答案可以在将来帮助某人。