mirror of
https://github.com/python/cpython.git
synced 2025-07-22 18:55:22 +00:00
Issue #28222: Merge from 3.5
This commit is contained in:
commit
d3dbba4174
1 changed files with 14 additions and 2 deletions
|
@ -7,6 +7,12 @@ from distutils.command.check import check, HAS_DOCUTILS
|
||||||
from distutils.tests import support
|
from distutils.tests import support
|
||||||
from distutils.errors import DistutilsSetupError
|
from distutils.errors import DistutilsSetupError
|
||||||
|
|
||||||
|
try:
|
||||||
|
import pygments
|
||||||
|
except ImportError:
|
||||||
|
pygments = None
|
||||||
|
|
||||||
|
|
||||||
class CheckTestCase(support.LoggingSilencer,
|
class CheckTestCase(support.LoggingSilencer,
|
||||||
support.TempdirManager,
|
support.TempdirManager,
|
||||||
unittest.TestCase):
|
unittest.TestCase):
|
||||||
|
@ -119,9 +125,15 @@ class CheckTestCase(support.LoggingSilencer,
|
||||||
pkg_info, dist = self.create_dist(long_description=rest_with_code)
|
pkg_info, dist = self.create_dist(long_description=rest_with_code)
|
||||||
cmd = check(dist)
|
cmd = check(dist)
|
||||||
cmd.check_restructuredtext()
|
cmd.check_restructuredtext()
|
||||||
self.assertEqual(cmd._warnings, 0)
|
|
||||||
msgs = cmd._check_rst_data(rest_with_code)
|
msgs = cmd._check_rst_data(rest_with_code)
|
||||||
self.assertEqual(len(msgs), 0)
|
if pygments is not None:
|
||||||
|
self.assertEqual(len(msgs), 0)
|
||||||
|
else:
|
||||||
|
self.assertEqual(len(msgs), 1)
|
||||||
|
self.assertEqual(
|
||||||
|
str(msgs[0][1]),
|
||||||
|
'Cannot analyze code. Pygments package not found.'
|
||||||
|
)
|
||||||
|
|
||||||
def test_check_all(self):
|
def test_check_all(self):
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue