Fix #5777. Don't warn when applying default style #5778

Merged
merged 3 commits into from Jan 5, 2016

Conversation

Projects
None yet
3 participants
Owner

mdboom commented Jan 1, 2016

No description provided.

@mdboom mdboom Fix #5777. Don't warn when applying default style
21b129f

mdboom added the needs_review label Jan 1, 2016

mdboom added this to the next major release (2.0) milestone Jan 1, 2016

Owner

jenshnielsen commented Jan 1, 2016

The context manager is badly named it does not actually catch any warnings it just resets the warning filter when leaving the context. I think you have to do:

with warnings.catch_warnings(record=True):
    warnings.simplefilter("ignore", UserWarning)
    _apply_style(rcParamsDefault)
Owner

jenshnielsen commented Jan 2, 2016

If I understand this correctly the with warnings.catch_warnings(record=True) means that the warning is only showed once but it is still showed exactly once

Owner

mdboom commented Jan 4, 2016

If I understand this correctly the with warnings.catch_warnings(record=True) means that the warning is only showed once but it is still showed exactly once

For me, at least, the warnings aren't shown at all, due to the record=True. But on further consideration, a think a new kwarg is better -- it will be more efficient, as there's no need to generate the warning object in the first place, only to catch and suppress it elsewhere. Updating this PR...

@mdboom mdboom Don't use catch_warnings
0a35fe4
Owner

jenshnielsen commented Jan 4, 2016

It's shown once in https://travis-ci.org/matplotlib/matplotlib/jobs/99718127 but that might be do to other reasons.

Owner

mdboom commented Jan 4, 2016

Let's see if the latest commit here fixes that warning in the doc build. If not, there's probably something else to track down.

Owner

jenshnielsen commented Jan 4, 2016

There is still a single /home/travis/build/matplotlib/matplotlib/lib/matplotlib/style/core.py:53: UserWarning: Style includes a parameter, 'backend', that is not related to style. Ignoring so that must presumably be triggered by some other code path.

@mdboom mdboom Fix warning during test
c515a9d

@jenshnielsen jenshnielsen added a commit that referenced this pull request Jan 5, 2016

@jenshnielsen jenshnielsen Merge pull request #5778 from mdboom/blacklist-warning
Fix #5777.  Don't warn when applying default style
fe701e3

@jenshnielsen jenshnielsen merged commit fe701e3 into matplotlib:master Jan 5, 2016

3 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage increased (+0.09%) to 68.596%
Details

@jenshnielsen jenshnielsen added a commit to jenshnielsen/matplotlib that referenced this pull request Jan 5, 2016

@jenshnielsen @jenshnielsen jenshnielsen + jenshnielsen Merge pull request #5778 from mdboom/blacklist-warning
Fix #5777.  Don't warn when applying default style
b68d050

jenshnielsen referenced this pull request Jan 5, 2016

Merged

Backport blacklist #5796

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment