[Python-ideas] Python-ideas Digest, Vol 90, Issue 30

Terry Reedy tjreedy at udel.edu
Fri May 23 02:45:33 CEST 2014


On 5/22/2014 4:43 AM, Antoine Pitrou wrote:
> On Thu, 22 May 2014 02:44:52 -0400
> Terry Reedy <tjreedy at udel.edu> wrote:
>>
>> When I used coverage (last summer) with tested Idle modules, I could not
>> get a reported 100% coverage because coverage counts the body of a final
>> "if __name__ == '__main__':" statement.
>
> There are flags to modify this behaviour.

Not directly, but yes, indirectly via --rcfile=FILE where FILE defaults 
to .coveragerc and the configuration file has
[report]
exclude_lines =
     if __name__ == .__main__.:

I believe Ned pointed that out to me when I reported the 'problem' to him.

If 'continue' were added under 'exclude_lines', the 'can't get 100% 
coverage' continue issue should go away also. (Yes, I know it is not 
quite that simple, as there will be times when continue is skipped that 
should be reported. But I suspect that there will nearly always be some 
other line skipped and reported, so that a false 100% will be rare.)

-- 
Terry Jan Reedy



More information about the Python-ideas mailing list