Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.010 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'subject:Python': 0.06; 'fixes': 0.07; '__name__': 0.09; 'items)': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'finney': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'statements,': 0.16; 'subject:program': 0.16; 'written.': 0.16; 'wrote:': 0.18; 'header :User-Agent:1': 0.23; 'looks': 0.24; 'header:X-Complaints-To:1': 0.27; 'url:code': 0.29; 'statement': 0.30; 'especially': 0.30; 'exclude': 0.31; 'writes:': 0.31; 'cases': 0.33; "i'd": 0.34; 'there': 0.35; 'coverage': 0.36; 'ben': 0.38; 'to:addr:python- list': 0.38; 'pm,': 0.38; 'track': 0.38; 'rather': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'how': 0.40; 'tell': 0.60; 'matter': 0.61; 'simple': 0.61; 'skip:\xe2 10': 0.65; 'special': 0.74; 'ethan': 0.84; 'furman': 0.84; 'difficult,': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Ben Finney Subject: Re: Python Coverage: testing a program Date: Fri, 25 Oct 2013 10:30:13 +1100 References: <5268a818$0$30000$c3e8da3$5496439d@news.astraweb.com> <7wtxg7cfww.fsf@benfinney.id.au> <526908b2$0$29981$c3e8da3$5496439d@news.astraweb.com> <52695CFB.9010309@nedbatchelder.com> <526984F3.3040905@udel.edu> <7weh7acrv8.fsf_-_@benfinney.id.au> <52699EFE.3070904@stoneleaf.us> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Gmane-NNTP-Posting-Host: rasputin.madmonks.org X-Public-Key-ID: 0xAC128405 X-Public-Key-Fingerprint: 517C F14B B2F3 98B0 CB35 4855 B8B2 4C06 AC12 8405 X-Public-Key-URL: http://www.benfinney.id.au/contact/bfinney-gpg.asc X-Post-From: Ben Finney User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux) Cancel-Lock: sha1:JMj+fUwu8vVGY8pflkYbCq/XmBw= X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 21 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1382657706 news.xs4all.nl 16005 [2001:888:2000:d::a6]:43832 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:57480 Ethan Furman writes: > On 10/24/2013 01:54 PM, Ben Finney wrote: > > You can do this already with current Coverage: tell Coverage to > > exclude > > 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