mirror of
https://github.com/facebook/sapling.git
synced 2024-10-10 00:45:18 +03:00
c87a2b01ec
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.
16 lines
440 B
Perl
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'
|
|
|
|
|