1

Here's my .coveragerc include = */<project-dir>/*

My sample script:

echo "Running unit tests along with coverage"
coverage run -m pytest
echo "printing coverage report"
ls -al
echo "getting coverage report"
coverage report --debug=trace 
exitCode=$?

This works fine locally however in Jenkins, I'm seeing this error

Coverage.py warning: No data was collected. (no-data-collected)

I can see Once coverage run -m pytest is run, .coverage file is created.

I'm confused since .coverage file exists, why is coverage report having trouble finding data?

wovano
  • 4,543
  • 5
  • 22
  • 49
Aqua267
  • 873
  • 3
  • 12
  • 35
  • Does this answer your question? [Coverage.py warning: No data was collected. (no-data-collected)](https://stackoverflow.com/questions/47287721/coverage-py-warning-no-data-was-collected-no-data-collected) – louis_guitton Mar 07 '20 at 15:29

1 Answers1

1

In my .coveragerc file, I had both options included which was conflicting.

Only measure the coverage of files with the following patterns

include = */<project_root>/*

Don't measure the coverage of files with the following patterns

omit = */<project_root>/<folder_name>/*

Once I removed include, the report started showing up.

Aqua267
  • 873
  • 3
  • 12
  • 35