0

我正在尝试实现测试代码覆盖率,但我遇到了工作服问题。为此,我正在遵循本指南:

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

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

由于该模块不可用,我尝试使用安装pip,我读到 apt 与 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

是否有安装覆盖模块的特殊方法?

4

1 回答 1

0

在做了更多研究之后,我找到了这个答案的解决方案。

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

install:
- pip install coveralls

系统报告我:

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

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

于 2015-10-22T10:01:42.377 回答