z4r / python-coveralls

Python API for http://coveralls.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ImportError when run with TravisCI

cobbdb opened this issue · comments

commented

This has worked in the past, but I just ran a build today and am now getting:
ImportError: cannot import name coverage

Here's the job that is now failing for me: https://travis-ci.org/cobbdb/jsinclude/jobs/36921871#L87
Here is how I'm calling coveralls in my tox file: https://github.com/cobbdb/jsinclude/blob/master/tox.ini#L39

Here is the relevant section from the console output:

45 passed in 1.02 seconds
py33-1.6-coverage runtests: commands[1] | coveralls
Traceback (most recent call last):
  File ".tox/py33-1.6-coverage/bin/coveralls", line 11, in <module>
    sys.exit(wear())
  File "/home/travis/build/cobbdb/jsinclude/.tox/py33-1.6-coverage/lib/python3.3/site-packages/coveralls/__init__.py", line 73, in wear
    from coveralls.control import coveralls
  File "/home/travis/build/cobbdb/jsinclude/.tox/py33-1.6-coverage/lib/python3.3/site-packages/coveralls/control.py", line 1, in <module>
    from coverage.control import coverage
ImportError: cannot import name coverage

I ran into the same error in my project. I executed the same tox environment locally and checked the coverage source code. It looks like tox pulled down coverage 4.0 which changes the import above to coverage.control.Coverage instead of coverage.control.coverage. I think coveralls needs to depend on version 3.7.1 explicitly. I put coverage==3.7.1 in my deps section and the import error went away.

commented

Yes! That did the trick, thank you a ton!
Link to commit for anyone else having this problem:
cobbdb/jsinclude@6cdd9f1#diff-b91f3d5bd63fcd17221b267e851608e8R43

Dan, this is still a valid error for python-coveralls since the requirements file (or the code) has not been updated. May I suggest that you leave the issue open until this project resolves it globally?

I'm glad my suggestion worked for you in your project. :)

commented

Oh I see, good point. Okay, reopened. Thanks again!

python-coveralls 2.4.3 on pypi