Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #36631

Re: pylint or similar to test version-specific language constructs?

Date 2013-01-11 11:09 -0500
From Dave Angel <d@davea.name>
Subject Re: pylint or similar to test version-specific language constructs?
References <1454e34f-5ca0-4f49-ad29-c99df4fdd322@gu9g2000vbb.googlegroups.com> <mailman.349.1357776502.2939.python-list@python.org> <QeednQoFKKHXUHLNnZ2dnUVZ8gadnZ2d@brightview.co.uk> <mailman.401.1357916818.2939.python-list@python.org> <50f031b5$0$30003$c3e8da3$5496439d@news.astraweb.com>
Newsgroups comp.lang.python
Message-ID <mailman.404.1357920575.2939.python-list@python.org> (permalink)

Show all headers | View raw


On 01/11/2013 10:37 AM, Steven D'Aprano wrote:
> On Fri, 11 Jan 2013 10:06:30 -0500, Dave Angel wrote:
>
>> <snip>
>
>> 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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

pylint or similar to test version-specific language constructs? jkn <jkn_gg@nicorp.f9.co.uk> - 2013-01-09 15:45 -0800
  Re: pylint or similar to test version-specific language constructs? Gisle Vanem <gvanem@broadpark.no> - 2013-01-10 01:07 +0100
    Re: pylint or similar to test version-specific language constructs? The Night Tripper <jkn+gg@nicorp.co.uk> - 2013-01-11 08:29 +0000
      Re: pylint or similar to test version-specific language constructs? Terry Reedy <tjreedy@udel.edu> - 2013-01-11 08:38 -0500
      Re: pylint or similar to test version-specific language constructs? Dave Angel <d@davea.name> - 2013-01-11 10:06 -0500
        Re: pylint or similar to test version-specific language constructs? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-01-11 15:37 +0000
          Re: pylint or similar to test version-specific language constructs? Dave Angel <d@davea.name> - 2013-01-11 11:09 -0500
        Re: pylint or similar to test version-specific language constructs? jkn <jkn_gg@nicorp.f9.co.uk> - 2013-01-13 09:56 -0800
          Re: pylint or similar to test version-specific language constructs? Chris Angelico <rosuav@gmail.com> - 2013-01-14 07:59 +1100
  Re: pylint or similar to test version-specific language constructs? thenault@gmail.com - 2013-01-11 00:35 -0800

csiph-web