summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorCosmin Poieana <cmin@ropython.org>2014-11-30 19:35:43 +0200
committerCosmin Poieana <cmin@ropython.org>2014-11-30 19:35:43 +0200
commit1931de081093394f4a9523da77b3f924a91b8ce2 (patch)
tree7a46aa3371114056dc59001e5013862257aea676 /test
parent81c4b6c37a9ee83570d92d6475789b612de7f7a8 (diff)
parent8a6e324ffc3f21dcd7cbbb6d7cccbee1d228e251 (diff)
downloadpylint-git-1931de081093394f4a9523da77b3f924a91b8ce2.tar.gz
Merge; Fix according to review
--HG-- branch : open_mode
Diffstat (limited to 'test')
-rw-r--r--test/functional/bad_open_mode.py4
-rw-r--r--test/functional/bad_open_mode.txt1
-rw-r--r--test/unittest_reporting.py47
3 files changed, 52 insertions, 0 deletions
diff --git a/test/functional/bad_open_mode.py b/test/functional/bad_open_mode.py
index 45c38bcb5..26d25c944 100644
--- a/test/functional/bad_open_mode.py
+++ b/test/functional/bad_open_mode.py
@@ -12,3 +12,7 @@ open('foo.bar', buffering=2)
WRITE_MODE = 'w'
open('foo.bar', 'U' + WRITE_MODE + 'z') # [bad-open-mode]
open('foo.bar', 'br') # [bad-open-mode]
+open('foo.bar', 'wU') # [bad-open-mode]
+open('foo.bar', 'r+b')
+open('foo.bar', 'r+')
+open('foo.bar', 'w+')
diff --git a/test/functional/bad_open_mode.txt b/test/functional/bad_open_mode.txt
index a94a16752..cd8c14b2b 100644
--- a/test/functional/bad_open_mode.txt
+++ b/test/functional/bad_open_mode.txt
@@ -5,3 +5,4 @@ bad-open-mode:9::"""Uw"" is not a valid mode for open."
bad-open-mode:10::"""2"" is not a valid mode for open."
bad-open-mode:13::"""Uwz"" is not a valid mode for open."
bad-open-mode:14::"""br"" is not a valid mode for open."
+bad-open-mode:15::"""wU"" is not a valid mode for open."
diff --git a/test/unittest_reporting.py b/test/unittest_reporting.py
index ef1de0c64..1850a98d6 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>&#160;</td>
+<td>1</td>
+<td>0</td>
+<td>Exactly one space required before comparison
+a&lt; 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()