Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!news.mixmin.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'operator': 0.03; 'revision': 0.05; 'subject:test': 0.07; 'python': 0.09; 'imported.': 0.09; 'subject:language': 0.09; 'subject:version': 0.09; 'programmer': 0.11; 'fail,': 0.16; 'naive': 0.16; 'operator.': 0.16; 'simplest': 0.16; 'ternary': 0.16; 'wrote:': 0.17; 'projects,': 0.17; 'test.': 0.17; 'jan': 0.18; 'saying': 0.18; 'tests': 0.18; 'module': 0.19; 'code.': 0.20; 'equivalent': 0.20; 'putting': 0.20; 'import': 0.21; 'libraries': 0.22; "i've": 0.23; 'testing': 0.24; 'header:In-Reply-To:1': 0.25; 'header:User- Agent:1': 0.26; 'am,': 0.27; 'bugs': 0.27; 'checking': 0.27; 'separate': 0.27; 'went': 0.28; 'run': 0.28; "d'aprano": 0.29; 'steven': 0.29; 'that.': 0.30; 'fri,': 0.30; 'code': 0.31; 'to:addr:python-list': 0.33; 'another': 0.33; 'subject:?': 0.35; "won't": 0.35; 'except': 0.36; 'but': 0.36; 'test': 0.36; 'does': 0.37; 'uses': 0.37; 'subject:: ': 0.38; 'unit': 0.38; 'mean': 0.38; 'some': 0.38; 'sure': 0.38; 'to:addr:python.org': 0.39; 'release': 0.39; 'received:192': 0.39; 'where': 0.40; 'received:192.168': 0.40; 'subject:-': 0.40; 'your': 0.60; 'real': 0.61; 'course.': 0.62; 'production': 0.63; 'show': 0.63; 'header :Reply-To:1': 0.68; 'present.': 0.71; 'received:74.208': 0.71; 'reply-to:no real name:2**0': 0.72; '2013': 0.84; 'received:74.208.4.194': 0.84; 'angel': 0.93 Date: Fri, 11 Jan 2013 11:09:15 -0500 From: Dave Angel User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121011 Thunderbird/16.0.1 MIME-Version: 1.0 To: python-list@python.org Subject: Re: pylint or similar to test version-specific language constructs? References: <1454e34f-5ca0-4f49-ad29-c99df4fdd322@gu9g2000vbb.googlegroups.com> <50f031b5$0$30003$c3e8da3$5496439d@news.astraweb.com> In-Reply-To: <50f031b5$0$30003$c3e8da3$5496439d@news.astraweb.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:yl9zIxYFTqhYFAcAde2BGztmGlp8/tn5D6HBHfVFl20 7W4UfP9lL2Dzzzhu6Hb2Nw8nUACi2MSryi3cA69XGS9CBtsCMR FKzj0dKOn0VPmSqpTEpYjadAxd3T8DZzyXRLnBzDjC9mo6Qak7 nD42US6v5eCc27pSGHfo6GAbs+6hRMdJdaWw3l75iyA8bpvuq5 wL+ddZbo2Ls60tIQ8hMyDP1ZOHVgVsElkmZ9nUwlsM48DnUGou 67753FOyq9knVekge89QjhzzYTQwoSym/ApWbQ/mAfZLtK5xx0 hzJbRHqL+iNyrV00qPWr1RaeZ1lvNTjPh55n3kA+GDq+SSKAA= = X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: d@davea.name 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: 34 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1357920575 news.xs4all.nl 6925 [2001:888:2000:d::a6]:34929 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:36631 On 01/11/2013 10:37 AM, Steven D'Aprano wrote: > On Fri, 11 Jan 2013 10:06:30 -0500, Dave Angel wrote: > >> > >> Not sure what you mean by beforehand. Don't you run all your unit tests >> before putting each revision of your code into production? So run those >> tests twice, once on 2.7, and once on 2.4. A unit test that's testing >> code with a ternary operator will fail, without any need for a separate >> test. > You don't even need tests for the code that includes the ternary > operator. The module simply won't compile in Python 2.4, you get a > SyntaxError when you try to import it or run it. > > You don't need PyLint to check for *illegal syntax*. Python already does > that. > You're right of course. But I can weasel out of it by saying that Python will only check it if the particular module is imported. I've seen equivalent bugs in real projects, where a release went out with one of its dynamic libraries not even present. Another thing that can stop Python from checking is if some naive programmer uses a bare except in production code. Both of these would show up in the simplest of unit testing code. -- DaveA