Python Coverage: testing a program

Terry Reedy tjreedy at udel.edu
Thu Oct 24 18:36:02 EDT 2013


On 10/24/2013 4:54 PM, Ben Finney wrote:
> Terry Reedy <tjreedy at udel.edu> writes:
>
>> On 10/24/2013 1:46 PM, Ned Batchelder wrote:
>>> It's been fun dropping the contortions for coverage.py 4.x, though!
>>
>> One request: ignore "if __name__ == '__main__':" clauses at the end of
>> files, which cannot be run under coverage.py, so 100% coverage is
>> reported as 100% instead of 9x%.
>
> You can do this already with current Coverage: tell Coverage to exclude
> <URL:http://nedbatchelder.com/code/coverage/excluding.html> specific
> statements, and it won't count them for coverage calculations.

OK, I added .coveragerc and that works. In the process of verifying 
this, I was reminded that there is an overt bug in the html report as 
displayed by Firefox. The fonts used for line numbers 
("class='linenos'") and line text ("class='text'") are slightly 
different and, more importantly, with difference sizes (line numbers are 
larger). So corresponding numbers and text do not line up with each 
other. This makes the J,K hotkeys and missing branch notations much less 
useful than intended. If I use cntl-scrollwheel to change text size, 
both change in the same proportion, so the mismatch is maintained.

-- 
Terry Jan Reedy




More information about the Python-list mailing list