Python Coverage: testing a program (was: Maintaining a backported module)

Ben Finney ben+python at benfinney.id.au
Thu Oct 24 16:54:03 EDT 2013


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.

-- 
 \         “If we don't believe in freedom of expression for people we |
  `\           despise, we don't believe in it at all.” —Noam Chomsky, |
_o__)                                                       1992-11-25 |
Ben Finney




More information about the Python-list mailing list