I am using coverage.py to measure the statement/code coverage of my test.
There are two files that are being tested:
"example_solution" contains a function "contains_negative()" that should return a boolean if any negative number is found within a list. "created_unit_test.py" is an automatically generated unit-test for "example_solution".
I run that code in my linux cli: coverage run --branch created_scripts/created_unit_test.py
And receive the report in ASCII form:
----------------------------------------------------------------------
Ran 4 tests in 0.001s
OK
Name Stmts Miss Branch BrPart Cover
------------------------------------------------------------------------
created_scripts/created_unit_test.py 12 1 0 0 92%
created_scripts/example_solution.py 3 1 2 0 80%
------------------------------------------------------------------------
TOTAL 15 2 2 0 88%
But the HTML reports, as shown in the images below, don't show where that one missed statement is.
My questions are:
This is the HTML report of the unit-test not highlighting the missed statement
The reports look very odd, but I also notice they are using coverage 5.5, which is quite old. Can you try with an updated version of coverage?
As to how the total is calculated: https://coverage.readthedocs.io/en/7.6.0/faq.html#q-how-is-the-total-percentage-calculated