@@ -95,28 +95,24 @@ def test_hinting_factor(factor):
9595 rtol = 0.1 )
9696
9797
98- @pytest .mark .skipif (sys .platform != "win32" ,
99- reason = "Need Windows font to test against" )
10098def test_utf16m_sfnt ():
101- segoe_ui_semibold = None
102- for f in fontManager .ttflist :
99+ try :
103100 # seguisbi = Microsoft Segoe UI Semibold
104- if f .fname [- 12 :] == "seguisbi.ttf" :
105- segoe_ui_semibold = f
106- break
101+ entry = next (entry for entry in fontManager .ttflist
102+ if Path (entry .fname ).name == "seguisbi.ttf" )
103+ except StopIteration :
104+ pytest .skip ("Couldn't find font to test against." )
107105 else :
108- pytest .xfail (reason = "Couldn't find font to test against." )
109-
110- # Check that we successfully read the "semibold" from the font's
111- # sfnt table and set its weight accordingly
112- assert segoe_ui_semibold .weight == "semibold"
106+ # Check that we successfully read "semibold" from the font's sfnt table
107+ # and set its weight accordingly.
108+ assert entry .weight == "semibold"
113109
114110
115- @pytest .mark .xfail (not (os .environ .get ("TRAVIS" ) and sys .platform == "linux" ),
116- reason = "Font may be missing." )
117111def test_find_ttc ():
118112 fp = FontProperties (family = ["WenQuanYi Zen Hei" ])
119113 if Path (findfont (fp )).name != "wqy-zenhei.ttc" :
114+ if not os .environ .get ("TRAVIS" ) or sys .platform != "linux" :
115+ pytest .skip ("Font may be missing" )
120116 # Travis appears to fail to pick up the ttc file sometimes. Try to
121117 # rebuild the cache and try again.
122118 fm ._rebuild ()
0 commit comments