summaryrefslogtreecommitdiffstats
path: root/Lib/distutils/tests
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2015-01-15 05:00:16 (GMT)
committerBenjamin Peterson <benjamin@python.org>2015-01-15 05:00:16 (GMT)
commit71f1c5c49646c365407c4686bf377b967f2f43b3 (patch)
tree33dbe6b5cfb78006334377719923b187b3ac1132 /Lib/distutils/tests
parent93e42c03b78fdb6b51153e5825ab9dc9f90b5e16 (diff)
parent562b7cbff9ec2a69694aabfb4845208c851bd08e (diff)
downloadcpython-71f1c5c49646c365407c4686bf377b967f2f43b3.zip
cpython-71f1c5c49646c365407c4686bf377b967f2f43b3.tar.gz
cpython-71f1c5c49646c365407c4686bf377b967f2f43b3.tar.bz2
merge 3.4 (#23063)
Diffstat (limited to 'Lib/distutils/tests')
-rw-r--r--Lib/distutils/tests/test_check.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/Lib/distutils/tests/test_check.py b/Lib/distutils/tests/test_check.py
index 601b686..959fa90 100644
--- a/Lib/distutils/tests/test_check.py
+++ b/Lib/distutils/tests/test_check.py
@@ -1,4 +1,5 @@
"""Tests for distutils.command.check."""
+import textwrap
import unittest
from test.support import run_unittest
@@ -92,6 +93,36 @@ class CheckTestCase(support.LoggingSilencer,
cmd = self._run(metadata, strict=1, restructuredtext=1)
self.assertEqual(cmd._warnings, 0)
+ @unittest.skipUnless(HAS_DOCUTILS, "won't test without docutils")
+ def test_check_restructuredtext_with_syntax_highlight(self):
+ # Don't fail if there is a `code` or `code-block` directive
+
+ example_rst_docs = []
+ example_rst_docs.append(textwrap.dedent("""\
+ Here's some code:
+
+ .. code:: python
+
+ def foo():
+ pass
+ """))
+ example_rst_docs.append(textwrap.dedent("""\
+ Here's some code:
+
+ .. code-block:: python
+
+ def foo():
+ pass
+ """))
+
+ for rest_with_code in example_rst_docs:
+ pkg_info, dist = self.create_dist(long_description=rest_with_code)
+ cmd = check(dist)
+ cmd.check_restructuredtext()
+ self.assertEqual(cmd._warnings, 0)
+ msgs = cmd._check_rst_data(rest_with_code)
+ self.assertEqual(len(msgs), 0)
+
def test_check_all(self):
metadata = {'url': 'xxx', 'author': 'xxx'}