33
44import difflib
55
6+ from matplotlib import rcParams , rcdefaults , use
7+
68
79_multiprocess_can_split_ = True
810
@@ -12,6 +14,7 @@ def setup():
1214 # it during all of the tests.
1315 import locale
1416 import warnings
17+ from matplotlib .backends import backend_agg , backend_pdf , backend_svg
1518
1619 try :
1720 locale .setlocale (locale .LC_ALL , str ('en_US.UTF-8' ))
@@ -28,11 +31,17 @@ def setup():
2831 # These settings *must* be hardcoded for running the comparison
2932 # tests and are not necessarily the default values as specified in
3033 # rcsetup.py
31- rcdefaults () # Start with all defaults
34+ rcdefaults () # Start with all defaults
3235 rcParams ['font.family' ] = 'Bitstream Vera Sans'
3336 rcParams ['text.hinting' ] = False
3437 rcParams ['text.hinting_factor' ] = 8
3538
39+ # Clear the font caches. Otherwise, the hinting mode can travel
40+ # from one test to another.
41+ backend_agg .RendererAgg ._fontd .clear ()
42+ backend_pdf .RendererPdf .truetype_font_cache .clear ()
43+ backend_svg .RendererSVG .fontd .clear ()
44+
3645
3746def assert_str_equal (reference_str , test_str ,
3847 format_str = 'String {str1} and {str2} do not match:\n {differences}' ):
0 commit comments