File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2222from matplotlib import ticker
2323from matplotlib import pyplot as plt
2424from matplotlib import ft2font
25+ from matplotlib import rcParams
2526from matplotlib .testing .noseclasses import KnownFailureTest , \
2627 KnownFailureDidNotFailTest , ImageComparisonFailure
2728from matplotlib .testing .compare import comparable_formats , compare_images , \
@@ -138,6 +139,7 @@ def check_freetype_version(ver):
138139class ImageComparisonTest (CleanupTest ):
139140 @classmethod
140141 def setup_class (cls ):
142+ CleanupTest .setup_class ()
141143 cls ._initial_settings = mpl .rcParams .copy ()
142144 try :
143145 matplotlib .style .use (cls ._style )
@@ -146,11 +148,8 @@ def setup_class(cls):
146148 mpl .rcParams .clear ()
147149 mpl .rcParams .update (cls ._initial_settings )
148150 raise
149- # Because the setup of a CleanupTest might involve
150- # modifying a few rcparams, this setup should come
151- # last prior to running the image test.
152- CleanupTest .setup_class ()
153151 cls .original_settings = cls ._initial_settings
152+ matplotlib .tests .set_font_settings_for_testing ()
154153 cls ._func ()
155154
156155 @classmethod
Original file line number Diff line number Diff line change 2222 'test data.' )
2323
2424
25+ def set_font_settings_for_testing ():
26+ rcParams ['font.family' ] = 'DejaVu Sans'
27+ rcParams ['text.hinting' ] = False
28+ rcParams ['text.hinting_factor' ] = 8
29+
30+
2531def setup ():
2632 # The baseline images are created in this locale, so we should use
2733 # it during all of the tests.
@@ -45,9 +51,8 @@ def setup():
4551 # tests and are not necessarily the default values as specified in
4652 # rcsetup.py
4753 rcdefaults () # Start with all defaults
48- rcParams ['font.family' ] = 'DejaVu Sans'
49- rcParams ['text.hinting' ] = False
50- rcParams ['text.hinting_factor' ] = 8
54+
55+ set_font_settings_for_testing ()
5156
5257
5358def assert_str_equal (reference_str , test_str ,
You can’t perform that action at this time.
0 commit comments