pythondjangocodecov

CodeCov is ignoring certain files. No settings for ignore in YAML. Python/Django


I have a Python Django project on GitHub and I'm using CodeCov with this project.

I have two apps in this Django project, a general app, and a general_api app. For some reason, all of the changes made in the general_api app files are being ignored.

I had YAML settings like this to ignore my test cases:

codecov:
  require_ci_to_pass: false
ignore:
- (?s:test_[^\/]+\.py.*)\Z
- (?s:tests_[^\/]+\.py.*)\Z
- ^test.py.*
- ^tests.py.*

However, I've removed them with the same issue.

Is there some other way to ignore, or set the ignore parameters in CodeCov other than the YAML settings?


Solution

  • The root of my problems was actually in how I was using coverage to generate my coverage report.

    I was previously using the command line: coverage run -m pytest

    This only creates a coverage report on files that have test cases against them or files that are interacted with while testing. Files that have no interaction or test cases would be completely omitted.

    I found through the coverage documentation, that I needed to add --source=. to my command line if I wanted the coverage report to include untested files. This is now showing all files in my root source.

    The final command was: coverage run --source=. -m pytest