##// END OF EJS Templates
pycompat: make pycompat demandimport friendly...
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.

File last commit:

r29584:06587edd default
r29584:06587edd default
Show More
test-check-pyflakes.t
15 lines | 440 B | text/troff | Tads3Lexer
/ tests / test-check-pyflakes.t
#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'