tests/test-check-pyflakes.t
author Matt Harbison <matt_harbison@yahoo.com>
Wed, 30 Mar 2022 00:57:08 -0400
changeset 48997 20c6c9e43397
parent 48996 54bf76d005df
child 49283 44b26349127b
permissions -rw-r--r--
tests: stop excluding the pycompat module from pyflakes I assume this was skipped because of all of the py2 stuff causing a lot of spew. The "unused" imports are left in place in case any 3rd party stuff is using it. I don't care about most of it, but TortoiseHg uses `io` and `queue`, so minimally I'd like to keep those. Differential Revision: https://phab.mercurial-scm.org/D12423

#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 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/pycompat.py:*:* 'codecs' imported but unused (glob)
  mercurial/pycompat.py:*:* 'concurrent.futures' imported but unused (glob)
  mercurial/pycompat.py:*:* 'http.client as httplib' imported but unused (glob)
  mercurial/pycompat.py:*:* 'http.cookiejar as cookielib' imported but unused (glob)
  mercurial/pycompat.py:*:* 'io' imported but unused (glob)
  mercurial/pycompat.py:*:* 'queue' imported but unused (glob)
  mercurial/pycompat.py:*:* 'socketserver' imported but unused (glob)
  mercurial/pycompat.py:*:* 'xmlrpc.client as xmlrpclib' imported but unused (glob)
  mercurial/util.py:*:* 'pickle' imported but unused (glob)