sapling/tests/test-check-pyflakes.t
Pulkit Goyal c87a2b01ec pycompat: make pycompat demandimport friendly
pycompat.py includes hack to import modules whose names are changed in Python 3.
We use try-except to load module according to the version of python. But this
method forces us to import the modules to raise an ImportError and hence making
it demandimport unfriendly.

This patch changes the try-except blocks to a single if-else block. To avoid
test-check-pyflakes.t complain about unused imports, pycompat.py is excluded
from the test.
2016-07-17 19:48:04 +05:30

16 lines
440 B
Perl

#require test-repo pyflakes hg10
$ . "$TESTDIR/helpers-testrepo.sh"
$ cd "`dirname "$TESTDIR"`"
run pyflakes on all tracked files ending in .py or without a file ending
(skipping binary file random-seed)
$ hg locate 'set:**.py or grep("^#!.*python")' \
> -X mercurial/pycompat.py \
> 2>/dev/null \
> | xargs pyflakes 2>/dev/null | "$TESTDIR/filterpyflakes.py"
tests/filterpyflakes.py:61: undefined name 'undefinedname'