pytest-dev / pytest-cov

Coverage plugin for pytest.
MIT License
1.73k stars 211 forks source link

0% coverage using GitLab CI #391

Open Rizhiy opened 4 years ago

Rizhiy commented 4 years ago

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 commented 4 years ago

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.