8000 MNT: skip sphinx tests per-test not per-module · matplotlib/matplotlib@e097a7e · GitHub
[go: up one dir, main page]

Skip to content

Commit e097a7e

Browse files
committed
MNT: skip sphinx tests per-test not per-module
1 parent f2b11b5 commit e097a7e

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

lib/matplotlib/tests/test_sphinxext.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,11 @@
1010
import pytest
1111

1212

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
1518

1619

1720
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):
3134
assert html_dir.is_dir()
3235

3336

37+
@sphinx_skipper
3438
def test_tinypages(tmp_path):
3539
shutil.copytree(Path(__file__).parent / 'tinypages', tmp_path,
3640
dirs_exist_ok=True)
@@ -116,6 +120,7 @@ def plot_directive_file(num):
116120
assert filecmp.cmp(range_6, plot_file(5))
117121

118122

123+
@sphinx_skipper
119124
def test_plot_html_show_source_link(tmp_path):
120125
parent = Path(__file__).parent
121126
shutil.copyfile(parent / 'tinypages/conf.py', tmp_path / 'conf.py')
@@ -138,6 +143,7 @@ def test_plot_html_show_source_link(tmp_path):
138143
assert len(list(html_dir2.glob("**/index-1.py"))) == 0
139144

140145

146+
@sphinx_skipper
141147
@pytest.mark.parametrize('plot_html_show_source_link', [0, 1])
142148
def test_show_source_link_true(tmp_path, plot_html_show_source_link):
143149
# 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):
158164
assert len(list(html_dir.glob("**/index-1.py"))) == 1
159165

160166

167+
@sphinx_skipper
161168
@pytest.mark.parametrize('plot_html_show_source_link', [0, 1])
162169
def test_show_source_link_false(tmp_path, plot_html_show_source_link):
163170
# Test that a source link is NOT generated if :show-source-link: is false,

0 commit comments

Comments
 (0)
0