Mercurial > hg
changeset 44498:aa0e1341457b
tests: check availability of pyflakes by trying to import pyflakes module
Since e397c6d74652, we use the pyflakes module instead of the pyflakes
executable. As was pointed out during the review, the hghave check can be
rewritten to try to import the pyflakes module instead of spawning a new
subprocess.
author | Manuel Jacob <me@manueljacob.de> |
---|---|
date | Wed, 11 Mar 2020 05:41:02 +0100 |
parents | 3265c92f7d13 |
children | 87b327de772c |
files | tests/hghave.py |
diffstat | 1 files changed, 8 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/hghave.py Thu Feb 27 22:34:45 2020 +0100 +++ b/tests/hghave.py Wed Mar 11 05:41:02 2020 +0100 @@ -574,11 +574,14 @@ @check("pyflakes", "Pyflakes python linter") def has_pyflakes(): - return matchoutput( - "sh -c \"echo 'import re' 2>&1 | $PYTHON -m pyflakes\"", - br"<stdin>:1: 're' imported but unused", - True, - ) + try: + import pyflakes + + pyflakes.__version__ + except ImportError: + return False + else: + return True @check("pylint", "Pylint python linter")