Error: No coverage report found

The repeated question, sorry for asking again, I could not resolve it by checking your tutorial and all the examples: I have a simple python package with a tests folder with some unit tests I am just using the python unittests utility and nothing else no pytest no tox nothing else:

this is my .codecov.yml:

coverage:
  status:
    patch: false
    project:
      default:
        threshold: 50%
comment:
  layout: "header"
  require_changes: false
  branches: null
  behavior: default
  flags: null
  paths: null
ignore:
  - "kim_property/_version.py"

this is my .travis.yml:

install:
 - pip install .
 - pip install codecov

script:
- python -m tests

after_success:
- codecov

I am getting this error:

v2.0.15
==> Detecting CI provider
Travis Detected
==> Preparing upload
==> Processing gcov (disable by -X gcov)
Executing gcov (find /home/travis/build/openkim/kim-property -not -path ‘./bower_components/’ -not -path './node_modules/’ -not -path ‘./vendor/**’ -type f -name ‘*.gcno’ -exec gcov -pb {} +)
==> Collecting reports
Error: No coverage report found

Can anyone help me?

Hi @yas

I don’t believe that the python tests module is able to generate coverage reports.

The easiest solution is to install and tell pytest to generate a coverage report in cobertura.xml format.

@drazisil When I do the same thing on my laptop it works and it produces the coverage.

What is the coverage file named?

@drazisil coverage.xml

Odd. Can you replace the codecov command with the bash uploader bash <(curl -s https://codecov.io/bash) and see if that works?

Now the error changed to

Python coveragepy exists disable via -X coveragepy
No .coverage file found.

You can try telling the uploader where the file is directly using the -f flag codecov-bash/codecov at master · codecov/codecov-bash · GitHub, but it’s really sounding like the file isn’t there for some reason. You may want to add a ls command before to confirm.

Thanks. I found another solution. Which is working nicely.

So I changed the

script:
- python -m tests

to

script:
- python -m coverage run -m tests
after_success:
- python -m codecov

1 Like