File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -253,11 +253,16 @@ def _test_threading():
253
253
from matplotlib .ft2font import LOAD_NO_HINTING
254
254
import matplotlib .font_manager as fm
255
255
256
+ def loud_excepthook (args ):
257
+ raise RuntimeError ("error in thread!" )
258
+
259
+ threading .excepthook = loud_excepthook
260
+
256
261
N = 10
257
262
b = threading .Barrier (N )
258
263
259
264
def bad_idea (n ):
260
- b .wait ()
265
+ b .wait (timeout = 5 )
261
266
for j in range (100 ):
262
267
font = fm .get_font (fm .findfont ("DejaVu Sans" ))
263
268
font .set_text (str (n ), 0.0 , flags = LOAD_NO_HINTING )
@@ -271,7 +276,9 @@ def bad_idea(n):
271
276
t .start ()
272
277
273
278
for t in threads :
274
- t .join ()
279
+ t .join (timeout = 9 )
280
+ if t .is_alive ():
281
+ raise RuntimeError ("thread failed to join" )
275
282
276
283
277
284
def test_fontcache_thread_safe ():
You can’t perform that action at this time.
0 commit comments