Question

with coverage, I can get the percent of untested functions

coverage run setup.py test ; coverage report

like this

Name                          Stmts   Miss  Cover
-------------------------------------------------
script                          565    278    51%
setup                             6      0   100%
...

how I can get the name of untested functions ?

Was it helpful?

Solution

If you run coverage report -m it will display the uncovered lines in the output under the missing column:

Name                      Stmts   Miss  Cover   Missing
-------------------------------------------------------
my_program                   20      4    80%   33-35, 39
my_other_module              56      6    89%   17-23
-------------------------------------------------------
TOTAL                        76     10    87%

If you run coverage html it will create a webpage where you can browse your source and see the uncovered lines highlighted a special color.

If you're looking to do your own processing on uncovered lines then you can run coverage xml and it will generate an XML file containing the missing lines.

If you really need the name of functions and not just line numbers (e.g. you want all functions that contain at least one uncovered line) then you will have to extract that yourself by reading in the source and the xml report and processing them with your own program.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top