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

Skip to content

Commit d8fb745

Browse files
committed
TST : known-fail rcparam exceptions tests
Added known-fail to tests that expect rcparam __init__ and update to raise exceptions on invalid input.
1 parent f1f5795 commit d8fb745

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

lib/matplotlib/tests/test_rcparams.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
import matplotlib as mpl
1111
from matplotlib.tests import assert_str_equal
12-
from matplotlib.testing.decorators import cleanup
12+
from matplotlib.testing.decorators import cleanup, knownfailureif
1313
from nose.tools import assert_true, assert_raises, assert_equal
1414
import nose
1515
from itertools import chain
@@ -104,6 +104,8 @@ def test_RcParams_class():
104104
assert ['font.family'] == list(six.iterkeys(rc.find_all('family')))
105105

106106

107+
# remove know failure + warnings after merging to master
108+
@knownfailureif(not (sys.version_info[:2] < (2, 7)))
107109
def test_rcparams_update():
108110
if sys.version_info[:2] < (2, 7):
109111
raise nose.SkipTest("assert_raises as context manager "
@@ -112,15 +114,26 @@ def test_rcparams_update():
112114
bad_dict = {'figure.figsize': (3.5, 42, 1)}
113115
# make sure validation happens on input
114116
with assert_raises(ValueError):
115-
rc.update(bad_dict)
117+
118+
with warnings.catch_warnings():
119+
warnings.filterwarnings('ignore',
120+
message='.*(validate)',
121+
category=UserWarning)
122+
rc.update(bad_dict)
116123

117124

125+
# remove know failure + warnings after merging to master
126+
@knownfailureif(not (sys.version_info[:2] < (2, 7)))
118127
def test_rcparams_init():
119128
if sys.version_info[:2] < (2, 7):
120129
raise nose.SkipTest("assert_raises as context manager "
121130
"not supported with Python < 2.7")
122131
with assert_raises(ValueError):
123-
mpl.RcParams({'figure.figsize': (3.5, 42, 1)})
132+
with warnings.catch_warnings():
133+
warnings.filterwarnings('ignore',
134+
message='.*(validate)',
135+
category=UserWarning)
136+
mpl.RcParams({'figure.figsize': (3.5, 42, 1)})
124137

125138

126139
@cleanup

0 commit comments

Comments
 (0)