tests/test-check-pyflakes.t
author Anton Shestakov <av6@dwimlabs.net>
Sat, 06 Jun 2020 19:15:11 +0800
branchstable
changeset 44959 170f8a43b5b8
parent 44958 f9099e210c57
child 44960 78cafd48b9b2
permissions -rw-r--r--
tests: adjust to the new format in pyflakes output According to the pyflakes' NEWS.rst, the default output format changed recently: 2.2.0 (2020-04-08) - Include column information in error messages So the lines now read: contrib/perf.py:149:15 undefined name 'xrange' mercurial/hgweb/server.py:427:13 undefined name 'reload' mercurial/util.py:2862:24 undefined name 'file' This is a graft of a similar fix that ended up on default. Differential Revision: https://phab.mercurial-scm.org/D8630

#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
  $ $PYTHON -m pyflakes test.py 2>/dev/null | "$TESTDIR/filterpyflakes.py"
  test.py:1:* undefined name 'undefinedname' (glob)
  
  $ 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 \
  > 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) (?)