[PATCH 7 of 7] test: add a basic 'test-check-pylint.t'

Pierre-Yves David pierre-yves.david at ens-lyon.org
Wed Mar 15 03:01:19 EDT 2017


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
# Date 1482964970 -3600
#      Wed Dec 28 23:42:50 2016 +0100
# Node ID e1b0b1909c43858ff4b4e1821afbee9626c4cf0f
# Parent  b24451e8f9a6beee5501e9bedc47af7edc283ea4
# EXP-Topic check-pylint
# Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
#              hg pull https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r e1b0b1909c43
test: add a basic 'test-check-pylint.t'

We add a minimal check using pylint for one case we knows we care about:
"mutable default" argument.

We'll likely extend this over time to cover other useful checks but this is a
good starting point.

diff --git a/tests/hghave.py b/tests/hghave.py
--- a/tests/hghave.py
+++ b/tests/hghave.py
@@ -413,6 +413,12 @@ def has_pyflakes():
                        br"<stdin>:1: 're' imported but unused",
                        True)
 
+ at check("pylint", "Pylint python linter")
+def has_pylint():
+    return matchoutput("pylint --help",
+                       br"Usage:  pylint",
+                       True)
+
 @check("pygments", "Pygments source highlighting library")
 def has_pygments():
     try:
diff --git a/tests/test-check-pylint.t b/tests/test-check-pylint.t
new file mode 100644
--- /dev/null
+++ b/tests/test-check-pylint.t
@@ -0,0 +1,12 @@
+#require test-repo pylint hg10
+
+Run pylint for known rules we care about.
+-----------------------------------------
+
+There should be no recorded failure, fix the codebase before introducing a new checks.
+
+Current check:
+- W0102: no mutable default argument
+
+  $ touch $TESTTMP/fakerc
+  $ pylint --rcfile=$TESTTMP/fakerc --disable=all --enable=W0102 --reports=no mercurial hgext hgext3rd


More information about the Mercurial-devel mailing list