Python Coverage: testing a program

Mark Lawrence breamoreboy at yahoo.co.uk
Thu Oct 24 17:55:07 EDT 2013


On 24/10/2013 21:54, 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.
>

An alternative to Ned's great bit of kit is figleaf.  This, Ned's and 
many other useful tools are listed here 
https://wiki.python.org/moin/PythonTestingToolsTaxonomy

-- 
Python is the second best programming language in the world.
But the best has yet to be invented.  Christian Tismer

Mark Lawrence




More information about the Python-list mailing list