Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 9666324

Browse filesBrowse files
committed
Merge pull request #2437 from mdboom/fix-randomly-failing-tests
Fix randomly failing tests
2 parents 42165c8 + 9eda53b commit 9666324
Copy full SHA for 9666324

File tree

Expand file treeCollapse file tree

1 file changed

+10
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+10
-1
lines changed

‎lib/matplotlib/tests/__init__.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/__init__.py
+10-1Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
import 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

3746
def assert_str_equal(reference_str, test_str,
3847
format_str='String {str1} and {str2} do not match:\n{differences}'):

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.