summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Courteau <j_courteau@hotmail.com>2012-04-21 20:59:06 -0400
committerJulien Courteau <j_courteau@hotmail.com>2012-04-21 20:59:06 -0400
commit5d5463009a93746b987f941b5698cf18ff6ec4fa (patch)
tree019079aed4655b50a49c4ce9822ee622ad249367
parenta511445037974f3f013bf3473378cf46c7656938 (diff)
downloaddisutils2-5d5463009a93746b987f941b5698cf18ff6ec4fa.tar.gz
fix: setup.py register fails if description has ReST uncompatible with Sphinx (#13614)
-rw-r--r--distutils2/metadata.py3
-rw-r--r--distutils2/tests/test_metadata.py9
2 files changed, 12 insertions, 0 deletions
diff --git a/distutils2/metadata.py b/distutils2/metadata.py
index 02ddf7a..8ea4d53 100644
--- a/distutils2/metadata.py
+++ b/distutils2/metadata.py
@@ -35,6 +35,9 @@ try:
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:
diff --git a/distutils2/tests/test_metadata.py b/distutils2/tests/test_metadata.py
index 4f586cb..80fc278 100644
--- a/distutils2/tests/test_metadata.py
+++ b/distutils2/tests/test_metadata.py
@@ -379,6 +379,15 @@ class MetadataTestCase(LoggingCatcher,
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')]