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
commitd56dc79f7687a322c507724f044b7dd22fc9cb2d (patch)
tree37d6f52617b5510ab5c9207b752c3cf6891c5241 /testutils.py
parent04c0ad7e5bcfa8c05c0f8662e32c44d9e32bf2a7 (diff)
downloadpylint-git-d56dc79f7687a322c507724f044b7dd22fc9cb2d.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 69ffde57c..8d8064dd7 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()