Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why weren't certain Python files examined by coverage.py?

I'm using coverage.py to measure test coverage in a Python project, but some Python files are not showing up in the coverage report. One thing that is different about these files is that they were not executed by any tests (i.e., if they were included in the report, their coverage would be 0%).

What are possible reasons why these files were not examined? If it's because they were never loaded during unit testing, is it possible to force coverage.py to include these files in the report?

like image 234
Lorin Hochstein Avatar asked Aug 28 '26 07:08

Lorin Hochstein


1 Answers

If your files are even not loaded during your testing session, they won't even appear in coverage result. But you can force coverage.py to measure "non" coverage in every file you want with the source option. It will include even non loaded source code to the coverage report.

like image 114
Cédric Julien Avatar answered Aug 29 '26 20:08

Cédric Julien



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!