8
8
9
9
import pytest
10
10
11
- try :
12
- import pygments
13
- except ImportError :
14
- pygments = None
15
-
16
-
17
11
HERE = os .path .dirname (__file__ )
18
12
19
13
@@ -103,7 +97,6 @@ def test_check_author_maintainer(self):
103
97
assert cmd ._warnings == 0
104
98
105
99
def test_check_document (self ):
106
- pytest .importorskip ('docutils' )
107
100
pkg_info , dist = self .create_dist ()
108
101
cmd = check (dist )
109
102
@@ -118,7 +111,6 @@ def test_check_document(self):
118
111
assert len (msgs ) == 0
119
112
120
113
def test_check_restructuredtext (self ):
121
- pytest .importorskip ('docutils' )
122
114
# let's see if it detects broken rest in long_description
123
115
broken_rest = 'title\n ===\n \n test'
124
116
pkg_info , dist = self .create_dist (long_description = broken_rest )
@@ -149,9 +141,7 @@ def test_check_restructuredtext(self):
149
141
assert cmd ._warnings == 0
150
142
151
143
def test_check_restructuredtext_with_syntax_highlight (self ):
152
- pytest .importorskip ('docutils' )
153
144
# Don't fail if there is a `code` or `code-block` directive
154
-
155
145
example_rst_docs = [
156
146
textwrap .dedent (
157
147
"""\
@@ -179,15 +169,9 @@ def foo():
179
169
pkg_info , dist = self .create_dist (long_description = rest_with_code )
180
170
cmd = check (dist )
181
171
cmd .check_restructuredtext ()
172
+ assert cmd ._warnings == 0
182
173
msgs = cmd ._check_rst_data (rest_with_code )
183
- if pygments is not None :
184
- assert len (msgs ) == 0
185
- else :
186
- assert len (msgs ) == 1
187
- assert (
188
- str (msgs [0 ][1 ])
189
- == 'Cannot analyze code. Pygments package not found.'
190
- )
174
+ assert len (msgs ) == 0
191
175
192
176
def test_check_all (self ):
193
177
with pytest .raises (DistutilsSetupError ):
0 commit comments