Mercurial > bitten > bitten-test
comparison bitten/build/tests/pythontools.py @ 915:e36f9b446976
Wrap lint report messages in a msg tag (includes a test and a documentation update). Fixes #547.
author | hodgestar |
---|---|
date | Mon, 23 May 2011 09:28:19 +0000 |
parents | 7c80375d4817 |
children |
comparison
equal
deleted
inserted
replaced
913:5bfdd7348d6f | 915:e36f9b446976 |
---|---|
208 self.summary = open(os.path.join(self.basedir, '.lint'), 'w') | 208 self.summary = open(os.path.join(self.basedir, '.lint'), 'w') |
209 | 209 |
210 def tearDown(self): | 210 def tearDown(self): |
211 shutil.rmtree(self.basedir) | 211 shutil.rmtree(self.basedir) |
212 | 212 |
213 def test_summary_format(self): | |
214 # thoroughly check on report line | |
215 self.summary.write(""" | |
216 %s/module/file1.py:42: [C] Missing docstring | |
217 """ % (self.ctxt.basedir,)) | |
218 self.summary.close() | |
219 pythontools.pylint(self.ctxt, file_=self.summary.name) | |
220 type, category, generator, xml = self.ctxt.output.pop() | |
221 self.assertEqual(Recipe.REPORT, type) | |
222 self.assertEqual('lint', category) | |
223 self.assertEqual(1, len(xml.children)) | |
224 child = xml.children[0] | |
225 self.assertEqual('problem', child.name) | |
226 self.assertEqual('module/file1.py', child.attr['file']) | |
227 self.assertEqual(1, len(child.children)) | |
228 msg = child.children[0] | |
229 self.assertEqual('msg', msg.name) | |
230 self.assertEqual(1, len(msg.children)) | |
231 self.assertEqual('Missing docstring', msg.children[0]) | |
232 | |
213 def test_summary_with_absolute_path(self): | 233 def test_summary_with_absolute_path(self): |
214 # One posix + one windows path to normalize | 234 # One posix + one windows path to normalize |
215 self.summary.write(""" | 235 self.summary.write(""" |
216 %s/module/file1.py:42: [C] Missing docstring | 236 %s/module/file1.py:42: [C] Missing docstring |
217 %s\\module\\file2.py:42: [C] Missing docstring | 237 %s\\module\\file2.py:42: [C] Missing docstring |
245 self.assertEqual('problem', child.name) | 265 self.assertEqual('problem', child.name) |
246 self.assertEqual('module/file1.py', child.attr['file']) | 266 self.assertEqual('module/file1.py', child.attr['file']) |
247 child = xml.children[1] | 267 child = xml.children[1] |
248 self.assertEqual('problem', child.name) | 268 self.assertEqual('problem', child.name) |
249 self.assertEqual('module/file2.py', child.attr['file']) | 269 self.assertEqual('module/file2.py', child.attr['file']) |
270 | |
250 | 271 |
251 class FigleafTestCase(unittest.TestCase): | 272 class FigleafTestCase(unittest.TestCase): |
252 | 273 |
253 def setUp(self): | 274 def setUp(self): |
254 self.basedir = os.path.realpath(tempfile.mkdtemp()) | 275 self.basedir = os.path.realpath(tempfile.mkdtemp()) |