summaryrefslogtreecommitdiff
path: root/testutils.py
diff options
context:
space:
mode:
authorSylvain Th?nault <sylvain.thenault@logilab.fr>2014-04-15 18:48:39 +0200
committerSylvain Th?nault <sylvain.thenault@logilab.fr>2014-04-15 18:48:39 +0200
commit2661908945c68572c2bf91abcadb61bf56db4aa0 (patch)
tree1b62080db407eaba05a7b4debec978bdf8ce9746 /testutils.py
parentac73444b00095d131433338214562c293238b002 (diff)
downloadpylint-2661908945c68572c2bf91abcadb61bf56db4aa0.tar.gz
[test utils] add walk method to CheckerTestCase
Diffstat (limited to 'testutils.py')
-rw-r--r--testutils.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/testutils.py b/testutils.py
index 69ffde5..8d8064d 100644
--- a/testutils.py
+++ b/testutils.py
@@ -30,6 +30,7 @@ from cStringIO import StringIO
from logilab.common import testlib
from pylint import checkers
+from pylint.utils import PyLintASTWalker
from pylint.reporters import BaseReporter
from pylint.interfaces import IReporter
from pylint.lint import PyLinter
@@ -201,6 +202,12 @@ class CheckerTestCase(testlib.TestCase):
'\n'.join(repr(m) for m in got)))
self.assertEqual(list(messages), got, msg)
+ def walk(self, node):
+ """recursive walk on the given node"""
+ walker = PyLintASTWalker(linter)
+ walker.add_checker(self.checker)
+ walker.walk(node)
+
# Init
test_reporter = TestReporter()