tests: use pyflakes module instead of pyflakes executable
This results in that the pyflakes version specific to the configured Python
version is used.
This way, both the Python 2-specific and the Python 3-specific pyflakes are run
by the test suite (depending on the configured Python version).
For downstream projects which are using Mercurial’s test infrastructure and are
not yet ported to Python 3 (e.g. hg-git) it ensures that the correct pyflakes
version is run even when the system’s default pyflakes is the Python 3-specific
one.
#require test-repo pyflakes hg10
$ . "$TESTDIR/helpers-testrepo.sh"
run pyflakes on all tracked files ending in .py or without a file ending
(skipping binary file random-seed)
$ cat > test.py <<EOF
> print(undefinedname)
> EOF
$ pyflakes test.py 2>/dev/null | "$TESTDIR/filterpyflakes.py"
test.py:1: undefined name 'undefinedname'
$ cd "`dirname "$TESTDIR"`"
$ testrepohg locate 'set:**.py or grep("^#!.*python")' \
> -X hgext/fsmonitor/pywatchman \
> -X mercurial/pycompat.py -X contrib/python-zstandard \
> -X mercurial/thirdparty/cbor \
> -X mercurial/thirdparty/concurrent \
> -X mercurial/thirdparty/zope \
> 2>/dev/null \
> | xargs $PYTHON -m pyflakes 2>/dev/null | "$TESTDIR/filterpyflakes.py"
contrib/perf.py:*: undefined name 'xrange' (glob) (?)
mercurial/hgweb/server.py:*: undefined name 'reload' (glob) (?)
mercurial/util.py:*: undefined name 'file' (glob) (?)
mercurial/encoding.py:*: undefined name 'localstr' (glob) (?)