pytest-cov icon indicating copy to clipboard operation
pytest-cov copied to clipboard

0% coverage using GitLab CI

Open Rizhiy opened this issue 5 years ago • 4 comments

Summary

If run using GitLab CI (.gitlab-ci.yml) the output is always 0%.

When I run the package on my local machine it reports correctly, but when it rans in CI it doesn't work. Not sure whether the problem is with package or with gitlab.

If I use coverage.py directly it works properly.

In the log it also says: "Coverage.py warning: No data was collected. (no-data-collected)", so I guess there is some storage problem.

Expected vs actual result

Expected: accurate coverage measurement Actual: Always reports 0%

Reproducer

Versions

Python 3.7.6, pytest==5.3.5, pytest-cov==2.8.1

Config

N/A

Rizhiy avatar Feb 25 '20 18:02 Rizhiy

Did some digging, found this: https://thomas-cokelaer.info/blog/2017/01/pytest-cov-collects-no-data-on-travis/.

Adding __init__.py to tests directory fixed the problem, not sure why, so leaving it open for now.

Rizhiy avatar Feb 25 '20 18:02 Rizhiy