8000 TST: add timeouts to font_manager + threading test · matplotlib/matplotlib@ab1de8e · GitHub
[go: up one dir, main page]

Skip to content

Commit ab1de8e

Browse files
committed
TST: add timeouts to font_manager + threading test
These tests are timing out on azure at the subprocess layer, also add timeouts at the threading layer.
1 parent 60e37f4 commit ab1de8e

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
@@ -253,11 +253,16 @@ def _test_threading():
253253
from matplotlib.ft2font import LOAD_NO_HINTING
254254
import matplotlib.font_manager as fm
255255

256+
def loud_execepthook(arg):
257+
raise RuntimeError("error in thread!")
258+
259+
threading.excepthook = loud_execepthook
260+
256261
N = 10
257262
b = threading.Barrier(N)
258263

259264
def bad_idea(n):
260-
b.wait()
265+
b.wait(timeout=.5)
261266
for j in range(100):
262267
font = fm.get_font(fm.findfont("DejaVu Sans"))
263268
font.set_text(str(n), 0.0, flags=LOAD_NO_HINTING)
@@ -271,7 +276,9 @@ def bad_idea(n):
271276
t.start()
272277

273278
for t in threads:
274-
t.join()
279+
t.join(timeout=1)
280+
if t.is_alive():
281+
raise RuntimeError("thread failed to join")
275282

276283

277284
def test_fontcache_thread_safe():

0 commit comments

Comments
 (0)
0