khanna-lab / cadre

Other
0 stars 0 forks source link

Coverage Report Statistics Question #24

Closed khanna7 closed 2 years ago

khanna7 commented 2 years ago

Use

coverage run -m unittest mytests.test_person.TestPerson
coverage report

OR as Daniel does:

coverage run -m unittest discover tests
coverage report

Either method produces

adityakhanna@adityakhanna python % coverage report
Name                                                                                  Stmts   Miss  Cover
---------------------------------------------------------------------------------------------------------
/usr/local/lib/python3.9/site-packages/_distutils_hack/__init__.py                       92     87     5%
/usr/local/lib/python3.9/site-packages/dateutil/__init__.py                               5      2    60%
/usr/local/lib/python3.9/site-packages/dateutil/_common.py                               25     15    40%
/usr/local/lib/python3.9/site-packages/dateutil/_version.py                               2      0   100%
/usr/local/lib/python3.9/site-packages/dateutil/easter.py                                27     20    26%
/usr/local/lib/python3.9/site-packages/dateutil/parser/__init__.py                       33      4    88%

…
mytests/test_person.py                                                                   57      1    98%
pycadre/__init__.py                                                                       0      0   100%
pycadre/cadre_model.py                                                                   60      8    87%
pycadre/cadre_person.py                                                                  44      1    98%

Above we see a bunch of other test information (not related to my package). Though the stats for my package are provided at the bottom of the table. How to focus this only on package?

khanna7 commented 2 years ago

The additional top matter is produced only on my personal MacBook, not on my work iMac.

khanna7 commented 2 years ago

The issue can be avoided with coverage run -m --source=pycadre/ unittest discover mytests