From c4d552329c2099daa62fb870c1efe6a1831aba2b Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Mon, 6 Mar 2017 23:27:53 -0500 Subject: [PATCH] TST: skip fc-list related tests if not installed --- lib/matplotlib/tests/test_font_manager.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/matplotlib/tests/test_font_manager.py b/lib/matplotlib/tests/test_font_manager.py index 0ce4a5ee077a..5e7a63790667 100644 --- a/lib/matplotlib/tests/test_font_manager.py +++ b/lib/matplotlib/tests/test_font_manager.py @@ -4,7 +4,6 @@ import six import os -import sys import tempfile import warnings @@ -15,6 +14,14 @@ get_fontconfig_fonts, is_opentype_cff_font, fontManager as fm) from matplotlib import rc_context +if six.PY2: + from distutils.spawn import find_executable + has_fclist = find_executable('fc-list') is not None +else: + # py >= 3.3 + from shutil import which + has_fclist = which('fc-list') is not None + def test_font_priority(): with rc_context(rc={ @@ -65,6 +72,6 @@ def test_otf(): assert res == is_opentype_cff_font(f) -@pytest.mark.skipif(sys.platform == 'win32', reason='no fontconfig on Windows') +@pytest.mark.skipif(not has_fclist, reason='no fontconfig installed') def test_get_fontconfig_fonts(): assert len(get_fontconfig_fonts()) > 1