Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit af79d51

Browse files
committed
Remove unnecessary init from mpl_toolkits tests.
The setup is a) not done for normal matplotlib tests and b) mostly implemented in the image_comparison decorator.
1 parent 0e57a0b commit af79d51

1 file changed

Lines changed: 0 additions & 51 deletions

File tree

lib/mpl_toolkits/tests/__init__.py

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
11
from __future__ import (absolute_import, division, print_function,
22
unicode_literals)
33

4-
import six
5-
6-
import difflib
74
import os
85

9-
from matplotlib import rcParams, rcdefaults, use
10-
116

127
_multiprocess_can_split_ = True
138

@@ -20,49 +15,3 @@
2015
'This is most likely because the test data is not installed. '
2116
'You may need to install matplotlib from source to get the '
2217
'test data.')
23-
24-
25-
def setup():
26-
# The baseline images are created in this locale, so we should use
27-
# it during all of the tests.
28-
import locale
29-
import warnings
30-
from matplotlib.backends import backend_agg, backend_pdf, backend_svg
31-
32-
try:
33-
locale.setlocale(locale.LC_ALL, str('en_US.UTF-8'))
34-
except locale.Error:
35-
try:
36-
locale.setlocale(locale.LC_ALL, str('English_United States.1252'))
37-
except locale.Error:
38-
warnings.warn(
39-
"Could not set locale to English/United States. "
40-
"Some date-related tests may fail")
41-
42-
use('Agg', warn=False) # use Agg backend for these tests
43-
44-
# These settings *must* be hardcoded for running the comparison
45-
# tests and are not necessarily the default values as specified in
46-
# rcsetup.py
47-
rcdefaults() # Start with all defaults
48-
rcParams['font.family'] = 'Bitstream Vera Sans'
49-
rcParams['text.hinting'] = False
50-
rcParams['text.hinting_factor'] = 8
51-
52-
53-
def assert_str_equal(reference_str, test_str,
54-
format_str=('String {str1} and {str2} do not '
55-
'match:\n{differences}')):
56-
"""
57-
Assert the two strings are equal. If not, fail and print their
58-
diffs using difflib.
59-
60-
"""
61-
if reference_str != test_str:
62-
diff = difflib.unified_diff(reference_str.splitlines(1),
63-
test_str.splitlines(1),
64-
'Reference', 'Test result',
65-
'', '', 0)
66-
raise ValueError(format_str.format(str1=reference_str,
67-
str2=test_str,
68-
differences=''.join(diff)))

0 commit comments

Comments
 (0)