Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Turn rcparams warning into error and remove knowfail #3719

Merged
merged 1 commit into from Oct 26, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 2 additions & 24 deletions lib/matplotlib/__init__.py
Expand Up @@ -834,14 +834,6 @@ def matplotlib_fname():
_all_deprecated = set(chain(_deprecated_ignore_map,
_deprecated_map, _obsolete_set))

_rcparam_warn_str = ("Trying to set {key} to {value} via the {func} "
"method of RcParams which does not validate cleanly. "
"This warning will turn into an Exception in 1.5. "
"If you think {value} should validate correctly for "
"rcParams[{key}] "
"please create an issue on github."
)


class RcParams(dict):

Expand All @@ -861,14 +853,7 @@ class RcParams(dict):
# validate values on the way in
def __init__(self, *args, **kwargs):
for k, v in six.iteritems(dict(*args, **kwargs)):
try:
self[k] = v
except (ValueError, RuntimeError):
# force the issue
warnings.warn(_rcparam_warn_str.format(key=repr(k),
value=repr(v),
func='__init__'))
dict.__setitem__(self, k, v)
self[k] = v

def __setitem__(self, key, val):
try:
Expand Down Expand Up @@ -908,14 +893,7 @@ def __getitem__(self, key):
# through __setitem__
def update(self, *args, **kwargs):
for k, v in six.iteritems(dict(*args, **kwargs)):
try:
self[k] = v
except (ValueError, RuntimeError):
# force the issue
warnings.warn(_rcparam_warn_str.format(key=repr(k),
value=repr(v),
func='update'))
dict.__setitem__(self, k, v)
self[k] = v

def __repr__(self):
import pprint
Expand Down
4 changes: 0 additions & 4 deletions lib/matplotlib/tests/test_rcparams.py
Expand Up @@ -105,8 +105,6 @@ def test_RcParams_class():
assert ['font.family'] == list(six.iterkeys(rc.find_all('family')))


# remove know failure + warnings after merging to master
@knownfailureif(not (sys.version_info[:2] < (2, 7)))
def test_rcparams_update():
if sys.version_info[:2] < (2, 7):
raise nose.SkipTest("assert_raises as context manager "
Expand All @@ -123,8 +121,6 @@ def test_rcparams_update():
rc.update(bad_dict)


# remove know failure + warnings after merging to master
@knownfailureif(not (sys.version_info[:2] < (2, 7)))
def test_rcparams_init():
if sys.version_info[:2] < (2, 7):
raise nose.SkipTest("assert_raises as context manager "
Expand Down