Search code examples
pytestcode-coveragetravis-cicodecov

Codecov: error processing coverage reports


I want to add codecov to this project. Yet, codecov says here that it can not process my coverage.xml file that I created with this command: pytest python/tests -v --junitxml=coverage.xml in the Travis CI script.

Everything prior to that like providing my token seems to work as suggested in the TravisCI build here.

I thought this could perhaps be a problem with the paths but I included a potential fix in the codecov.yml and nothing changed.

Therefore, I do not think that the script codecov.yml, travis.yml, and utils/travis_runner.py are part of the problem.


Solution

  • The --junitxml option is for generating reports in JUnit format. Use the option --cov-report to generate coverage reports. pytest-cov allows passing --cov-report multiple times to generate reports in different formats. Example:

    $ pip install pytest pytest-cov
    $ pytest --cov=mypkg --cov-report term --cov-report xml:coverage.xml
    

    will print the coverage table and generate the Cobertura XML report which is CodeCov-compatible.