changeset 44479:e397c6d74652

tests: use pyflakes module instead of pyflakes executable This results in that the pyflakes version specific to the configured Python version is used. This way, both the Python 2-specific and the Python 3-specific pyflakes are run by the test suite (depending on the configured Python version). For downstream projects which are using Mercurial’s test infrastructure and are not yet ported to Python 3 (e.g. hg-git) it ensures that the correct pyflakes version is run even when the system’s default pyflakes is the Python 3-specific one.
author Manuel Jacob <me@manueljacob.de>
date Fri, 06 Mar 2020 23:04:58 +0100
parents c8fd21413458
children 6aee0647e026
files tests/hghave.py tests/test-check-pyflakes.t
diffstat 2 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/tests/hghave.py	Tue Mar 03 15:56:00 2020 +0100
+++ b/tests/hghave.py	Fri Mar 06 23:04:58 2020 +0100
@@ -553,7 +553,7 @@
 @check("pyflakes", "Pyflakes python linter")
 def has_pyflakes():
     return matchoutput(
-        "sh -c \"echo 'import re' 2>&1 | pyflakes\"",
+        "sh -c \"echo 'import re' 2>&1 | $PYTHON -m pyflakes\"",
         br"<stdin>:1: 're' imported but unused",
         True,
     )
--- a/tests/test-check-pyflakes.t	Tue Mar 03 15:56:00 2020 +0100
+++ b/tests/test-check-pyflakes.t	Fri Mar 06 23:04:58 2020 +0100
@@ -20,7 +20,7 @@
   > -X mercurial/thirdparty/concurrent \
   > -X mercurial/thirdparty/zope \
   > 2>/dev/null \
-  > | xargs pyflakes 2>/dev/null | "$TESTDIR/filterpyflakes.py"
+  > | 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/util.py:*: undefined name 'file' (glob) (?)