[PATCH 3 of 3 V2] test-pyflakes: detect undefined name error

FUJIWARA Katsunori foozy at lares.dti.ne.jp
Thu May 8 12:35:35 CDT 2014


At Thu, 08 May 2014 11:34:55 -0500,
Matt Mackall wrote:
> 
> On Fri, 2014-05-09 at 01:25 +0900, FUJIWARA Katsunori wrote:
> > At Fri, 02 May 2014 19:14:37 +0900,
> > Yuya Nishihara wrote:
> > > 
> > > # HG changeset patch
> > > # User Yuya Nishihara <yuya at tcha.org>
> > > # Date 1398743641 -32400
> > > #      Tue Apr 29 12:54:01 2014 +0900
> > > # Node ID b7b37547eec4246671f7ae28843a6931813b810d
> > > # Parent  de513875f008f333f320aca0b236b6e8af54cdbf
> > > test-pyflakes: detect undefined name error
> > > 
> > > It should be able to catch the following mistakes at 2606e7f227f6:
> > > 
> > >     mercurial/exchange.py:590: undefined name 'UnknownPartError'
> > >     mercurial/match.py:346: undefined name 'pat'
> > >     mercurial/win32.py:365: undefined name '_ERROR_NO_MORE_FILES'
> > >     tests/killdaemons.py:46: undefined name 'check'
> > > 
> > > diff --git a/tests/filterpyflakes.py b/tests/filterpyflakes.py
> > > --- a/tests/filterpyflakes.py
> > > +++ b/tests/filterpyflakes.py
> > > @@ -32,6 +32,7 @@ for line in sys.stdin:
> > >              r"imported but unused",
> > >              r"local variable '.*' is assigned to but never used",
> > >              r"unable to detect undefined names",
> > > +            r"undefined name '.*'",
> > >             ]
> > >      for msgtype, pat in enumerate(pats):
> > >          if re.search(pat, line):
> > 
> > According to my bisect-ing, this change (0768cda8b579 in master repo)
> > seems to break "test-check-pyflakes.t" as below:
> > 
> >     ====================
> >     @@ -17,5 +17,7 @@
> >        tests/hghave.py:*: 'pygments' imported but unused (glob)
> >        tests/hghave.py:*: 'ssl' imported but unused (glob)
> >        contrib/win32/hgwebdir_wsgi.py:93: 'from isapi.install import *' used; unable to detect undefined names (glob)
> >     +  mercurial/util.py:116: undefined name 'memoryview'
> >     +  mercurial/windows.py:34: undefined name 'WindowsError'
> >     
> >      #endif
> >     ====================
> > 
> > Is this failure specific to my environment (python 2.6.6 on debian
> > 2.6.32), or just expected failure ?
> 
> Probably a version issue, possibly with pyflakes.

Thanks. I also remembered the thread about pyflakes version problem
below, and tried to use recent pyflakes:

    http://thread.gmane.org/gmane.comp.version-control.mercurial.devel/68364/focus=68385

Then, pyflakes 0.8.1 can avoid "undefined name 'WindowsError'", but
not "undefined name 'memoryview'" yet:

    ====================
    @@ -17,5 +17,6 @@
       tests/hghave.py:*: 'pygments' imported but unused (glob)
       tests/hghave.py:*: 'ssl' imported but unused (glob)
       contrib/win32/hgwebdir_wsgi.py:93: 'from isapi.install import *' used; unable to detect undefined names (glob)
    +  mercurial/util.py:116: undefined name 'memoryview'
    
     #endif
    ====================

Is the reason of this failure that "memoryview" is not available on
python 2.6.x ?

----------------------------------------------------------------------
[FUJIWARA Katsunori]                             foozy at lares.dti.ne.jp


More information about the Mercurial-devel mailing list