10
10
import pytest
11
11
12
12
13
- pytest .importorskip ('sphinx' ,
14
- minversion = None if sys .version_info < (3 , 10 ) else '4.1.3' )
13
+ def sphinx_skipper (func ):
14
+ pytest .importorskip (
15
+ 'sphinx' ,
16
+ minversion = None if sys .version_info < (3 , 10 ) else '4.1.3' )
17
+ return func
15
18
16
19
17
20
def _build_sphinx_html (source_dir , doctree_dir , html_dir , extra_args = None ):
@@ -31,6 +34,7 @@ def _build_sphinx_html(source_dir, doctree_dir, html_dir, extra_args=None):
31
34
assert html_dir .is_dir ()
32
35
33
36
37
+ @sphinx_skipper
34
38
def test_tinypages (tmp_path ):
35
39
shutil .copytree (Path (__file__ ).parent / 'tinypages' , tmp_path ,
36
40
dirs_exist_ok = True )
@@ -116,6 +120,7 @@ def plot_directive_file(num):
116
120
assert filecmp .cmp (range_6 , plot_file (5 ))
117
121
118
122
123
+ @sphinx_skipper
119
124
def test_plot_html_show_source_link (tmp_path ):
120
125
parent = Path (__file__ ).parent
121
126
shutil .copyfile (parent / 'tinypages/conf.py' , tmp_path / 'conf.py' )
@@ -138,6 +143,7 @@ def test_plot_html_show_source_link(tmp_path):
138
143
assert len (list (html_dir2 .glob ("**/index-1.py" ))) == 0
139
144
140
145
146
+ @sphinx_skipper
141
147
@pytest .mark .parametrize ('plot_html_show_source_link' , [0 , 1 ])
142
148
def test_show_source_link_true (tmp_path , plot_html_show_source_link ):
143
149
# Test that a source link is generated if :show-source-link: is true,
@@ -158,6 +164,7 @@ def test_show_source_link_true(tmp_path, plot_html_show_source_link):
158
164
assert len (list (html_dir .glob ("**/index-1.py" ))) == 1
159
165
160
166
167
+ @sphinx_skipper
161
168
@pytest .mark .parametrize ('plot_html_show_source_link' , [0 , 1 ])
162
169
def test_show_source_link_false (tmp_path , plot_html_show_source_link ):
163
170
# Test that a source link is NOT generated if :show-source-link: is false,
0 commit comments