6
6
7
7
import matplotlib
8
8
import matplotlib .ft2font
9
- from packaging .version import Version
10
9
import pytest
10
+ from packaging .version import Version
11
11
12
12
from .helpers import assert_existence , diff_summary , patch_summary
13
13
20
20
HASH_LIBRARY_FLAG = rf'--mpl-hash-library={ HASH_LIBRARY } '
21
21
FULL_BASELINE_PATH = Path (__file__ ).parent / 'baseline'
22
22
23
- BASELINE_IMAGES_FLAG = '--mpl-baseline-path=baseline'
23
+ BASELINE_IMAGES_FLAG_REL = ['--mpl-baseline-path=baseline' , '--mpl-baseline-relative' ]
24
+ BASELINE_IMAGES_FLAG_ABS = rf'--mpl-baseline-path={ FULL_BASELINE_PATH } '
24
25
25
26
TEST_FILE = Path (__file__ ).parent / 'subtest.py'
26
27
@@ -121,19 +122,19 @@ def test_hash(tmp_path):
121
122
122
123
@pytest .mark .skipif (not HASH_LIBRARY .exists (), reason = "No hash library for this mpl version" )
123
124
def test_hybrid (tmp_path ):
124
- run_subtest ('test_hybrid' , tmp_path , [HASH_LIBRARY_FLAG , BASELINE_IMAGES_FLAG ])
125
+ run_subtest ('test_hybrid' , tmp_path , [HASH_LIBRARY_FLAG , BASELINE_IMAGES_FLAG_ABS ])
125
126
126
127
127
128
@pytest .mark .skipif (not HASH_LIBRARY .exists (), reason = "No hash library for this mpl version" )
128
129
def test_results_always (tmp_path ):
129
130
run_subtest ('test_results_always' , tmp_path ,
130
- [HASH_LIBRARY_FLAG , BASELINE_IMAGES_FLAG , '--mpl-results-always' ])
131
+ [HASH_LIBRARY_FLAG , BASELINE_IMAGES_FLAG_ABS , '--mpl-results-always' ])
131
132
132
133
133
134
@pytest .mark .skipif (not HASH_LIBRARY .exists (), reason = "No hash library for this mpl version" )
134
135
def test_html (tmp_path ):
135
136
run_subtest ('test_results_always' , tmp_path ,
136
- [HASH_LIBRARY_FLAG , BASELINE_IMAGES_FLAG ], summaries = ['html' ])
137
+ [HASH_LIBRARY_FLAG , BASELINE_IMAGES_FLAG_ABS ], summaries = ['html' ])
137
138
assert (tmp_path / 'results' / 'fig_comparison.html' ).exists ()
138
139
assert (tmp_path / 'results' / 'extra.js' ).exists ()
139
140
assert (tmp_path / 'results' / 'styles.css' ).exists ()
@@ -157,5 +158,5 @@ def test_html_images_only(tmp_path):
157
158
@pytest .mark .skipif (not HASH_LIBRARY .exists (), reason = "No hash library for this mpl version" )
158
159
def test_basic_html (tmp_path ):
159
160
run_subtest ('test_results_always' , tmp_path ,
160
- [HASH_LIBRARY_FLAG , BASELINE_IMAGES_FLAG ], summaries = ['basic-html' ])
161
+ [HASH_LIBRARY_FLAG , * BASELINE_IMAGES_FLAG_REL ], summaries = ['basic-html' ])
161
162
assert (tmp_path / 'results' / 'fig_comparison_basic.html' ).exists ()
0 commit comments