tests/test-check-pyflakes.t
author Anton Shestakov <av6@dwimlabs.net>
Sat, 06 Jun 2020 19:19:27 +0800
changeset 44952 a4438263b228
parent 44938 3d409f4ff46b
child 44960 78cafd48b9b2
permissions -rw-r--r--
tests: skip pyflakes for mercurial/thirdparty/ The current version of pyflakes (2.2.0) correctly detects one issue: mercurial/thirdparty/selectors2.py:335:40 '...'.format(...) has unused arguments at position(s): 1 But we're not interested in fixing lint errors in third-party code, so we need to exclude at least selectors2.py. And in the discussion for this patch it was decided to just skip the entire thirdparty directory. Differential Revision: https://phab.mercurial-scm.org/D8619

#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) (?)