diff options
author | Calin Don <calin.don@gmail.com> | 2014-11-22 16:04:31 +0200 |
---|---|---|
committer | Calin Don <calin.don@gmail.com> | 2014-11-22 16:04:31 +0200 |
commit | 4a78c82f5f3064fbc17e6c37cf36b536c00c26bd (patch) | |
tree | d2bba6c61264f1e5756b8afbb24ab705b8248303 | |
parent | e0c681e65138e9f69567cfdaadb89ec603129608 (diff) | |
download | pylint-4a78c82f5f3064fbc17e6c37cf36b536c00c26bd.tar.gz |
Added test for issue #263
-rw-r--r-- | test/unittest_reporting.py | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/test/unittest_reporting.py b/test/unittest_reporting.py index ef1de0c..1850a98 100644 --- a/test/unittest_reporting.py +++ b/test/unittest_reporting.py @@ -17,9 +17,11 @@ import unittest import six +from logilab.common.ureports import Section from pylint.lint import PyLinter from pylint import checkers from pylint.reporters.text import TextReporter, ParseableTextReporter +from pylint.reporters.html import HTMLReporter HERE = abspath(dirname(__file__)) INPUTDIR = join(HERE, 'input') @@ -62,6 +64,51 @@ class PyLinterTC(unittest.TestCase): '0123:1: [C0301(line-too-long), ] ' 'Line too long (1/2)\n') + @unittest.expectedFailure + def test_html_reporter_type(self): + # Integration test for issue #263 + # https://bitbucket.org/logilab/pylint/issue/263/html-report-type-problems + expected = '''<html> +<body> +<div> +<div> +<h2>Messages</h2> +<table> +<tr class="header"> +<th>type</th> +<th>module</th> +<th>object</th> +<th>line</th> +<th>col_offset</th> +<th>message</th> +</tr> +<tr class="even"> +<td>convention</td> +<td>0123</td> +<td> </td> +<td>1</td> +<td>0</td> +<td>Exactly one space required before comparison +a< 5: print "zero"</td> +</tr> +</table> +</div> +</div> +</body> +</html> +''' + output = six.StringIO() + linter = PyLinter(reporter=HTMLReporter()) + checkers.initialize(linter) + linter.config.persistent = 0 + linter.reporter.set_output(output) + linter.open() + linter.set_current_module('0123') + linter.add_message('bad-whitespace', line=1, + args=('Exactly one', 'required', 'before', + 'comparison', 'a< 5: print "zero"')) + linter.reporter.display_results(Section()) + self.assertMultiLineEqual(output.getvalue(), expected) if __name__ == '__main__': unittest.main() |