Python Coverage: testing a program

Ben Finney ben+python at benfinney.id.au
Thu Oct 24 19:30:13 EDT 2013


Ethan Furman <ethan at stoneleaf.us> writes:

> On 10/24/2013 01:54 PM, Ben Finney wrote:
> > 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.
>
> While that's neat (being able to exclude items) is there any reason to
> ever count the `if __name__ == '__main__'` clause?

I'd rather Coverage not go down the track of accumulating special cases
based on how they're written. A simple pragma fixes the problem, no
matter what the exact statement looks like.

-- 
 \           “Prediction is very difficult, especially of the future.” |
  `\                                                       —Niels Bohr |
_o__)                                                                  |
Ben Finney




More information about the Python-list mailing list