Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 33faad1

Browse files
committed
Wait until font caches exist before starting tests
1 parent 8eef95e commit 33faad1

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

lib/matplotlib/font_manager.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1284,6 +1284,7 @@ def is_opentype_cff_font(filename):
12841284
return False
12851285

12861286
fontManager = None
1287+
_fmcache = None
12871288

12881289
# The experimental fontconfig-based backend.
12891290
if USE_FONTCONFIG and sys.platform != 'win32':
@@ -1329,10 +1330,6 @@ def findfont(prop, fontext='ttf'):
13291330
_fmcache = os.path.join(cachedir, 'fontList.py3k.cache')
13301331
else:
13311332
_fmcache = os.path.join(cachedir, 'fontList.cache')
1332-
else:
1333-
# Should only happen in a restricted environment (such as Google App
1334-
# Engine). Deal with this gracefully by not caching fonts.
1335-
_fmcache = None
13361333

13371334
fontManager = None
13381335

tests.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,23 @@
55
# See http://somethingaboutorange.com/mrl/projects/nose/1.0.0/usage.html
66
# for options.
77

8+
import os
9+
import time
10+
811
import matplotlib
912
matplotlib.use('agg')
1013

1114
import nose
1215
from matplotlib.testing.noseclasses import KnownFailure
1316
from matplotlib import default_test_modules
1417

18+
from matplotlib import font_manager
19+
# Make sure the font caches are created before starting any possibly
20+
# parallel tests
21+
if font_manager._fmcache is not None:
22+
while not os.path.exists(font_manager._fmcache):
23+
time.sleep(0.5)
24+
1525
def run():
1626
nose.main(addplugins=[KnownFailure()],
1727
defaultTest=default_test_modules)

0 commit comments

Comments
 (0)