Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions Lib/distutils/tests/test_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@
from distutils.tests import support
from distutils.errors import DistutilsSetupError

try:
import pygments
except ImportError:
pygments = None


class CheckTestCase(support.LoggingSilencer,
support.TempdirManager,
unittest.TestCase):
Expand Down Expand Up @@ -120,9 +126,15 @@ def foo():
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)
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):

Expand Down