I'm trying to setup a small python library with coveralls.io through travis-ci.
The current structure of the library is:
libconfig
├── .coverage
├── .coveragerc
├── .coveralls.yml
├── LICENSE
├── README.md
├── REQUIREMENTS
├── .gitignore
├── .travis.yml
├── libconfig
│ ├── __init__.py
│ ├── config.py
│ ├── evaluator.py
│ ├── tests
│ │ └── test_libconfig.py
│ └── util.py
├── package.json
├── setup.cfg
└── setup.py
My .coveragerc
looks like this:
[run]
branch = False
omit = */tests/*
[report]
# Regexes for lines to exclude from consideration
exclude_lines =
# Have to re-enable the standard pragma
pragma: no cover
# Don't complain about missing debug-only code:
def __repr__
if self\.debug
# Don't complain if tests don't hit defensive assertion code:
raise AssertionError
raise NotImplementedError
raise IOError
raise ValueError
# Don't complain if non-runnable code isn't run:
if 0:
if __name__ == .__main__.:
show_missing = True
ignore_errors = True
[html]
directory = coverage_html_report
and when I locally run the pytests, it does give me the coverage:
pytest --cov-config .coveragerc --cov=libconfig libconfig/tests
=========================== test session starts ============================
platform darwin -- Python 2.7.12, pytest-3.4.1, py-1.5.2, pluggy-0.6.0
rootdir: /Users/bonet/SandBox/libconfig, inifile:
plugins: cov-2.5.1
collected 5 items
libconfig/tests/test_libconfig.py ..... [100%]
---------- coverage: platform darwin, python 2.7.12-final-0 ----------
Name Stmts Miss Cover Missing
------------------------------------------------------
libconfig/__init__.py 1 0 100%
libconfig/config.py 116 0 100%
libconfig/evaluator.py 20 0 100%
libconfig/util.py 34 0 100%
------------------------------------------------------
TOTAL 171 0 100%
========================= 5 passed in 1.56 seconds =========================
Then, I have my .travis.yml
configuration file:
language: python
python:
- '2.7'
- '3.5'
- '3.6'
install:
- pip install -r REQUIREMENTS
- pip install coverage coveralls
- pip install python-coveralls
- pip install pytest pytest-cov
script:
- python setup.py install
- pytest --cov-config .coveragerc --cov=libconfig libconfig/tests
- coverage report --show-missing
after_success:
- coveralls
But, when this runs in travis-ci, it does not give me any coverage:
The command "pytest --cov-config .coveragerc --cov=libconfig libconfig/tests" exited with 0.
$ coverage report --show-missing
Name Stmts Miss Cover Missing
------------------------------------------------------
libconfig/__init__.py 1 1 0% 8
libconfig/config.py 116 116 0% 13-404
libconfig/evaluator.py 20 20 0% 13-47
libconfig/util.py 34 34 0% 9-68
------------------------------------------------------
TOTAL 171 171 0%
The command "coverage report --show-missing" exited with 0.
I've been looking around, but I haven't found a solution that would solve this issue, any help will be very appreciated.