66
77import matplotlib
88import matplotlib .ft2font
9- from packaging .version import Version
109import pytest
10+ from packaging .version import Version
1111
1212from .helpers import assert_existence , diff_summary , patch_summary
1313
2020HASH_LIBRARY_FLAG = rf'--mpl-hash-library={ HASH_LIBRARY } '
2121FULL_BASELINE_PATH = Path (__file__ ).parent / 'baseline'
2222
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 } '
2425
2526TEST_FILE = Path (__file__ ).parent / 'subtest.py'
2627
@@ -121,19 +122,19 @@ def test_hash(tmp_path):
121122
122123@pytest .mark .skipif (not HASH_LIBRARY .exists (), reason = "No hash library for this mpl version" )
123124def 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 ])
125126
126127
127128@pytest .mark .skipif (not HASH_LIBRARY .exists (), reason = "No hash library for this mpl version" )
128129def test_results_always (tmp_path ):
129130 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' ])
131132
132133
133134@pytest .mark .skipif (not HASH_LIBRARY .exists (), reason = "No hash library for this mpl version" )
134135def test_html (tmp_path ):
135136 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' ])
137138 assert (tmp_path / 'results' / 'fig_comparison.html' ).exists ()
138139 assert (tmp_path / 'results' / 'extra.js' ).exists ()
139140 assert (tmp_path / 'results' / 'styles.css' ).exists ()
@@ -157,5 +158,5 @@ def test_html_images_only(tmp_path):
157158@pytest .mark .skipif (not HASH_LIBRARY .exists (), reason = "No hash library for this mpl version" )
158159def test_basic_html (tmp_path ):
159160 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' ])
161162 assert (tmp_path / 'results' / 'fig_comparison_basic.html' ).exists ()
0 commit comments