changeset 916:5d9fedf2f851 0.6.x

0.6dev: Merged [997] from trunk.
author hodgestar
date Mon, 23 May 2011 09:39:11 +0000
parents bcc8f7f95b77
children
files bitten/build/pythontools.py bitten/build/tests/pythontools.py doc/reports.txt
diffstat 3 files changed, 26 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/bitten/build/pythontools.py
+++ b/bitten/build/pythontools.py
@@ -173,7 +173,7 @@
                     problems.append(xmlio.Element('problem', category=category,
                                                   type=msg_type, tag=tag,
                                                   line=lineno, file=filename)[
-                        match.group('msg') or ''
+                        xmlio.Element('msg')[match.group('msg') or '']
                     ])
             ctxt.report('lint', problems)
         finally:
--- 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):
--- a/doc/reports.txt
+++ b/doc/reports.txt
@@ -121,6 +121,9 @@
 |                 | ``convention \| warning \| refactor \| error``           |
 +-----------------+----------------------------------------------------------+
 
+Each ``<problem />`` elements may contain a ``<msg>`` element whose
+text is the issue description reported by pylint.
+
 Example:
 
 .. code-block:: xml
@@ -130,6 +133,6 @@
                 line="17"
                 tag="TestResultsChartGenerator"
                 file="bitten/report/testing.py">
-            Missing docstring
+            <msg>Missing docstring</msg>
         </problem>
     </report>
Copyright (C) 2012-2017 Edgewall Software