Path: csiph.com!usenet.pasdenom.info!gegeweb.org!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed2.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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:Python': 0.06; '"if': 0.09; '__name__': 0.09; 'from:addr:ethan': 0.09; 'from:addr:stoneleaf.us': 0.09; 'from:name:ethan furman': 0.09; 'items)': 0.09; 'message-id:@stoneleaf.us': 0.09; '~ethan~': 0.09; '(apologies': 0.16; 'clauses': 0.16; 'coverage?': 0.16; 'finney': 0.16; 'received:69.93': 0.16; 'received:gateway13.websitewelcome.com': 0.16; 'reedy': 0.16; 'statements,': 0.16; 'subject:program': 0.16; 'ignore': 0.16; 'wrote:': 0.18; '>>>': 0.22; 'header:User-Agent:1': 0.23; 'header :In-Reply-To:1': 0.27; 'url:code': 0.29; "i'm": 0.30; 'exclude': 0.31; 'writes:': 0.31; 'run': 0.32; 'could': 0.34; 'but': 0.35; 'there': 0.35; 'coverage': 0.36; 'ben': 0.38; 'question,': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'reported': 0.39; 'to:addr:python.org': 0.39; 'tell': 0.60; 'myself': 0.63; '100%': 0.77; 'batchelder': 0.84; 'request:': 0.91 Date: Thu, 24 Oct 2013 15:28:14 -0700 From: Ethan Furman User-Agent: Mozilla/5.0 (X11; Linux i686; rv:16.0) Gecko/20121010 Thunderbird/16.0.1 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Python Coverage: testing a program 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> In-Reply-To: <7weh7acrv8.fsf_-_@benfinney.id.au> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator3304.hostgator.com X-AntiAbuse: Original Domain - python.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - stoneleaf.us X-BWhitelist: no X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: ([192.168.5.100]) [64.134.136.14]:49030 X-Source-Auth: ethan+stoneleaf.us X-Email-Count: 1 X-Source-Cap: dG9idWs7dG9idWs7Z2F0b3IzMzA0Lmhvc3RnYXRvci5jb20= 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: 24 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1382655124 news.xs4all.nl 15886 [2001:888:2000:d::a6]:57853 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:57478 On 10/24/2013 01:54 PM, Ben Finney wrote: > Terry Reedy 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 > 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? Are there any circumstances where it could run under Coverage? (Apologies if this is a dumb question, I know nothing about Coverage myself -- but I'm going to go look it up now. ;) -- ~Ethan~