changeset 31413:aa797bd54f44

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.
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Wed, 28 Dec 2016 23:42:50 +0100
parents ecc87acb4d10
children 279cbde7bf3d
files tests/hghave.py tests/test-check-pylint.t
diffstat 2 files changed, 21 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/tests/hghave.py	Tue Mar 14 23:50:07 2017 -0700
+++ b/tests/hghave.py	Wed Dec 28 23:42:50 2016 +0100
@@ -413,6 +413,12 @@
                        br"<stdin>:1: 're' imported but unused",
                        True)
 
+@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:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-check-pylint.t	Wed Dec 28 23:42:50 2016 +0100
@@ -0,0 +1,15 @@
+#require test-repo pylint hg10
+
+Run pylint for known rules we care about.
+-----------------------------------------
+
+There should be no recorded failures; fix the codebase before introducing a
+new check.
+
+Current checks:
+- W0102: no mutable default argument
+
+  $ touch $TESTTMP/fakerc
+  $ pylint --rcfile=$TESTTMP/fakerc --disable=all \
+  >   --enable=W0102 --reports=no \
+  >   mercurial hgext hgext3rd