z4r/python-coveralls

ImportError: cannot import name 'Reporter'

Choi-Sung-Hoon opened this issue ยท 5 comments

coverage and coveralls work well in local environment but not on Travis CI.

installed python packages in virtualenv in local environment are

(django) ubuntu@ip-172-31-12-72:~/django$ pip list
Package             Version
------------------- ----------
asgiref             3.2.3
certifi             2019.11.28
chardet             3.0.4
coverage            5.0.2
coveralls           1.10.0
Django              3.0.2
djangorestframework 3.11.0
docopt              0.6.2
entrypoints         0.3
flake8              3.7.9
idna                2.8
mccabe              0.6.1
pip                 19.3.1
pycodestyle         2.5.0
pyflakes            2.1.1
python-coveralls    2.9.3
pytz                2019.3
PyYAML              5.2
requests            2.22.0
setuptools          44.0.0
six                 1.13.0
sqlparse            0.3.0
urllib3             1.25.7
wheel               0.33.6

and I tested coverage and coverage worked well

(django) ubuntu@ip-172-31-12-72:~/django$ coverage run --source=pollsapi/polls pollsapi/manage.py test pollsapi
Creating test database for alias 'default'...
System check identified no issues (0 silenced).
...
----------------------------------------------------------------------
Ran 3 tests in 0.655s

OK
Destroying test database for alias 'default'...
(django) ubuntu@ip-172-31-12-72:~/django$ coverage report
Name                                        Stmts   Miss  Cover
---------------------------------------------------------------
pollsapi/polls/__init__.py                      0      0   100%
pollsapi/polls/admin.py                         4      0   100%
pollsapi/polls/apiviews.py                     56     23    59%
pollsapi/polls/apps.py                          3      3     0%
pollsapi/polls/migrations/0001_initial.py       7      0   100%
pollsapi/polls/migrations/__init__.py           0      0   100%
pollsapi/polls/models.py                       19      2    89%
pollsapi/polls/serializers.py                  29      5    83%
pollsapi/polls/tests.py                        33      0   100%
pollsapi/polls/urls.py                          8      0   100%
pollsapi/polls/views.py                        12     12     0%
---------------------------------------------------------------
TOTAL                                         171     45    74%

and it reported to coveralls.io successfully

(django) ubuntu@ip-172-31-12-72:~/django$ coveralls
Submitting coverage to coveralls.io...
Coverage submitted!
Job ##6.1
https://coveralls.io/jobs/57700125

but the problem is that this doesn't work on Travis CI.

Here's .travis.yml (requirements.txt is created by pip freeze > requirements.txt)

(django) ubuntu@ip-172-31-12-72:~/django$ cat .travis.yml
language: python
dist: bionic
git:
  clone: true
  autocrlf: true
virtualenv:
  system_site_packages: true
install:
  - pip install -r requirements.txt
script:
  - flake8
  - python pollsapi/manage.py test pollsapi
  - coverage run --source=pollsapi/polls pollsapi/manage.py test pollsapi
after_success:
  - coveralls
#jobs:
#  include:
#    - stage: "Test"
#      name: "Unit Tests"
#      script: echo "Running unit tests..."
#      script: *******
#    - name: "Integration Tests"
#      script: echo "Running integration tests..."
#      script: ********

on Travis CI, I get this error every time I merge changes onto master branch

image

It was due to duplicated coveralls pip package.

In my case, coveralls and python-coveralls were installed in the same virtual environment.

After I deleted python-coveralls, it worked well.

I didn't test after deleting coveralls.

Close this issue.

I had the same issue because I was using pip to install python-coveralls:

https://github.com/d-Rickyy-b/pastepwn/blob/441c4e2ab1f8bd5a410db560b8f840ebedce7e26/.travis.yml#L8-L12

and then running coverage run (441c4e2)

But then I eventually wanted to call coveralls which caused some issue.

Replacing the pip install python-coveralls with pip install coveralls worked out! It seems I never actually needed python-coveralls in the first place.

(See fixing commit)

I had the same issue because I was using pip to install python-coveralls:

https://github.com/d-Rickyy-b/pastepwn/blob/441c4e2ab1f8bd5a410db560b8f840ebedce7e26/.travis.yml#L8-L12

and then running coverage run (441c4e2)

But then I eventually wanted to call coveralls which caused some issue.

Replacing the pip install python-coveralls with pip install coveralls worked out! It seems I never actually needed python-coveralls in the first place.

(See fixing commit)

Should I reopen this issue for the others who need this information?

Good to hear that you resolved the problem with my issue. :)

Should I reopen this issue for the others who need this information?

I don't think it's necessary to reopen it. People could use the search/show closed issues. But it might help them finding it faster. I don't know if that helps ๐Ÿ˜„ .

I believe this could actually be fixed via the setup.py throwing an error on conflicting dependency detection