diff 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
line wrap: on
line diff
--- a/bitten/build/tests/pythontools.py
+++ b/bitten/build/tests/pythontools.py
@@ -210,6 +210,26 @@
     def tearDown(self):
         shutil.rmtree(self.basedir)
 
+    def test_summary_format(self):
+        # thoroughly check on report line
+        self.summary.write("""
+%s/module/file1.py:42: [C] Missing docstring
+""" % (self.ctxt.basedir,))
+        self.summary.close()
+        pythontools.pylint(self.ctxt, file_=self.summary.name)
+        type, category, generator, xml = self.ctxt.output.pop()
+        self.assertEqual(Recipe.REPORT, type)
+        self.assertEqual('lint', category)
+        self.assertEqual(1, len(xml.children))
+        child = xml.children[0]
+        self.assertEqual('problem', child.name)
+        self.assertEqual('module/file1.py', child.attr['file'])
+        self.assertEqual(1, len(child.children))
+        msg = child.children[0]
+        self.assertEqual('msg', msg.name)
+        self.assertEqual(1, len(msg.children))
+        self.assertEqual('Missing docstring', msg.children[0])
+
     def test_summary_with_absolute_path(self):
         # One posix + one windows path to normalize
         self.summary.write("""
@@ -248,6 +268,7 @@
         self.assertEqual('problem', child.name)
         self.assertEqual('module/file2.py', child.attr['file'])
 
+
 class FigleafTestCase(unittest.TestCase):
 
     def setUp(self):
Copyright (C) 2012-2017 Edgewall Software