3
3
4
4
import difflib
5
5
6
+ from matplotlib import rcParams , rcdefaults , use
7
+
6
8
7
9
_multiprocess_can_split_ = True
8
10
@@ -12,6 +14,7 @@ def setup():
12
14
# it during all of the tests.
13
15
import locale
14
16
import warnings
17
+ from matplotlib .backends import backend_agg , backend_pdf , backend_svg
15
18
16
19
try :
17
20
locale .setlocale (locale .LC_ALL , str ('en_US.UTF-8' ))
@@ -28,11 +31,17 @@ def setup():
28
31
# These settings *must* be hardcoded for running the comparison
29
32
# tests and are not necessarily the default values as specified in
30
33
# rcsetup.py
31
- rcdefaults () # Start with all defaults
34
+ rcdefaults () # Start with all defaults
32
35
rcParams ['font.family' ] = 'Bitstream Vera Sans'
33
36
rcParams ['text.hinting' ] = False
34
37
rcParams ['text.hinting_factor' ] = 8
35
38
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
+
36
45
37
46
def assert_str_equal (reference_str , test_str ,
38
47
format_str = 'String {str1} and {str2} do not match:\n {differences}' ):
0 commit comments