[Python-checkins] distutils2 (merge default -> default): merge #1364

eric.araujo python-checkins at python.org
Wed May 16 07:07:26 CEST 2012


http://hg.python.org/distutils2/rev/6480b23cdf48
changeset:   1322:6480b23cdf48
parent:      1318:64b0bf5e0596
parent:      1321:70c683338f9b
user:        Julien Courteau <j_courteau at hotmail.com>
date:        Sat May 12 14:23:20 2012 -0400
summary:
  merge #1364

files:
  distutils2/metadata.py            |  5 ++++-
  distutils2/tests/test_metadata.py |  9 +++++++++
  2 files changed, 13 insertions(+), 1 deletions(-)


diff --git a/distutils2/metadata.py b/distutils2/metadata.py
--- a/distutils2/metadata.py
+++ b/distutils2/metadata.py
@@ -35,6 +35,9 @@
 
         def system_message(self, level, message, *children, **kwargs):
             self.messages.append((level, message, children, kwargs))
+            return nodes.system_message(message, level=level, type=self.
+                    levels[level], *children, **kwargs)
+
 
     _HAS_DOCUTILS = True
 except ImportError:
@@ -480,7 +483,7 @@
         return value
 
     def check(self, strict=False, restructuredtext=False):
-        """Check if the metadata is compliant. If strict is False then raise if
+        """Check if the metadata is compliant. If strict is True then raise if
         no Name or Version are provided"""
         self.set_metadata_version()
 
diff --git a/distutils2/tests/test_metadata.py b/distutils2/tests/test_metadata.py
--- a/distutils2/tests/test_metadata.py
+++ b/distutils2/tests/test_metadata.py
@@ -379,6 +379,15 @@
         folded_desc = desc.replace('\n', '\n' + (7 * ' ') + '|')
         self.assertIn(folded_desc, out.getvalue())
 
+    def test_description_invalid_rst(self):
+        # make sure bad rst is well handled in the description attribute
+        metadata = Metadata()
+        description_with_bad_rst = ':funkie:`str`'  # Sphinx-specific markup
+        metadata['description'] = description_with_bad_rst
+        missing, warnings = metadata.check(restructuredtext=True)
+        warning = warnings[0][1]
+        self.assertIn('funkie', warning)
+
     def test_project_url(self):
         metadata = Metadata()
         metadata['Project-URL'] = [('one', 'http://ok')]

-- 
Repository URL: http://hg.python.org/distutils2


More information about the Python-checkins mailing list