Skip to content

Commit cd45753

Browse files
committed
Skip tests without required libraries
1 parent 49fcd8d commit cd45753

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

tests/subtests/test_subtest.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import matplotlib
88
import matplotlib.ft2font
99
from packaging.version import Version
10+
import pytest
1011

1112
from .helpers import assert_existence, diff_summary, patch_summary
1213

@@ -113,19 +114,23 @@ def test_default(tmp_path):
113114
run_subtest('test_default', tmp_path, [])
114115

115116

117+
@pytest.mark.skipif(not HASH_LIBRARY.exists(), reason="No hash library for this mpl version")
116118
def test_hash(tmp_path):
117119
run_subtest('test_hash', tmp_path, [HASH_LIBRARY_FLAG])
118120

119121

122+
@pytest.mark.skipif(not HASH_LIBRARY.exists(), reason="No hash library for this mpl version")
120123
def test_hybrid(tmp_path):
121124
run_subtest('test_hybrid', tmp_path, [HASH_LIBRARY_FLAG, BASELINE_IMAGES_FLAG])
122125

123126

127+
@pytest.mark.skipif(not HASH_LIBRARY.exists(), reason="No hash library for this mpl version")
124128
def test_results_always(tmp_path):
125129
run_subtest('test_results_always', tmp_path,
126130
[HASH_LIBRARY_FLAG, BASELINE_IMAGES_FLAG, '--mpl-results-always'])
127131

128132

133+
@pytest.mark.skipif(not HASH_LIBRARY.exists(), reason="No hash library for this mpl version")
129134
def test_html(tmp_path):
130135
run_subtest('test_results_always', tmp_path,
131136
[HASH_LIBRARY_FLAG, BASELINE_IMAGES_FLAG], summaries=['html'])
@@ -134,6 +139,7 @@ def test_html(tmp_path):
134139
assert (tmp_path / 'results' / 'styles.css').exists()
135140

136141

142+
@pytest.mark.skipif(not HASH_LIBRARY.exists(), reason="No hash library for this mpl version")
137143
def test_html_hashes_only(tmp_path):
138144
run_subtest('test_html_hashes_only', tmp_path, [HASH_LIBRARY_FLAG], summaries=['html'])
139145
assert (tmp_path / 'results' / 'fig_comparison.html').exists()
@@ -148,6 +154,7 @@ def test_html_images_only(tmp_path):
148154
assert (tmp_path / 'results' / 'styles.css').exists()
149155

150156

157+
@pytest.mark.skipif(not HASH_LIBRARY.exists(), reason="No hash library for this mpl version")
151158
def test_basic_html(tmp_path):
152159
run_subtest('test_results_always', tmp_path,
153160
[HASH_LIBRARY_FLAG, BASELINE_IMAGES_FLAG], summaries=['basic-html'])

0 commit comments

Comments
 (0)