Skip to content

Commit 9a7d9db

Browse files
authored
Merge pull request #8213 from tacaswell/tst_skip_fclist_test
TST: skip fc-list related tests if not installed
2 parents 8277ddf + c4d5523 commit 9a7d9db

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

lib/matplotlib/tests/test_font_manager.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import six
55

66
import os
7-
import sys
87
import tempfile
98
import warnings
109

@@ -15,6 +14,14 @@
1514
get_fontconfig_fonts, is_opentype_cff_font, fontManager as fm)
1615
from matplotlib import rc_context
1716

17+
if six.PY2:
18+
from distutils.spawn import find_executable
19+
has_fclist = find_executable('fc-list') is not None
20+
else:
21+
# py >= 3.3
22+
from shutil import which
23+
has_fclist = which('fc-list') is not None
24+
1825

1926
def test_font_priority():
2027
with rc_context(rc={
@@ -65,6 +72,6 @@ def test_otf():
6572
assert res == is_opentype_cff_font(f)
6673

6774

68-
@pytest.mark.skipif(sys.platform == 'win32', reason='no fontconfig on Windows')
75+
@pytest.mark.skipif(not has_fclist, reason='no fontconfig installed')
6976
def test_get_fontconfig_fonts():
7077
assert len(get_fontconfig_fonts()) > 1

0 commit comments

Comments
 (0)