[PATCH] test-check-pyflakes.t: accept warnings for unused imports in windows.py

Adrian Buehlmann adrian at cadifra.com
Tue Aug 2 02:03:29 CDT 2011


On 2011-08-02 02:26, Mads Kiilerich wrote:
> # HG changeset patch
> # User Mads Kiilerich <mads at kiilerich.com>
> # Date 1312244721 -7200
> # Node ID adf2946cbb9b74a3c22a7754e55e5f1e209cbdca
> # Parent  d0424f39984c6d623dc8c55b85de66f15e27abd6
> test-check-pyflakes.t: accept warnings for unused imports in windows.py
> 
> The intention with the imports is to make the functions defined in win32
> available in the namespace of the windows module.

Indeed. And those names *are* used. Just not in windows.py. Which
pyflakes fails to see for these mass imports.

> diff --git a/tests/test-check-pyflakes.t b/tests/test-check-pyflakes.t
> --- a/tests/test-check-pyflakes.t
> +++ b/tests/test-check-pyflakes.t
> @@ -4,8 +4,20 @@
>    mercurial/hgweb/server.py:*: 'activeCount' imported but unused (glob)
>    mercurial/commands.py:*: 'base85' imported but unused (glob)
>    mercurial/commands.py:*: 'bdiff' imported but unused (glob)
> +  mercurial/windows.py:*: 'executablepath' imported but unused (glob)
> +  mercurial/windows.py:*: 'getuser' imported but unused (glob)
> +  mercurial/windows.py:*: 'hidewindow' imported but unused (glob)
> +  mercurial/windows.py:*: 'lookupreg' imported but unused (glob)
> +  mercurial/windows.py:*: 'makedir' imported but unused (glob)
>    mercurial/commands.py:*: 'mpatch' imported but unused (glob)
> +  mercurial/windows.py:*: 'nlinks' imported but unused (glob)
> +  mercurial/windows.py:*: 'oslink' imported but unused (glob)
>    mercurial/commands.py:*: 'osutil' imported but unused (glob)
> +  mercurial/windows.py:*: 'samedevice' imported but unused (glob)
> +  mercurial/windows.py:*: 'samefile' imported but unused (glob)
> +  mercurial/windows.py:*: 'setsignalhandler' imported but unused (glob)
> +  mercurial/windows.py:*: 'spawndetached' imported but unused (glob)
> +  mercurial/windows.py:*: 'testpid' imported but unused (glob)
>    hgext/inotify/linux/__init__.py:*: 'from _inotify import *' used; unable to detect undefined names (glob)

So we have to update test-check-pyflakes.t each time we add such an
import. Tedious.

FWIW, my first version of the patch ("windows: eliminate win32 wildcard
import") - which you didn't like - sidestepped this pyflakes problem.



More information about the Mercurial-devel mailing list