Skip to content

ERR: Better error message for missing matplotlib #20538

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

Merged
merged 5 commits into from
Apr 9, 2018

Conversation

TomAugspurger
Copy link
Contributor

Closes #19810

@TomAugspurger TomAugspurger added the Visualization plotting label Mar 29, 2018
@TomAugspurger TomAugspurger added this to the 0.23.0 milestone Mar 29, 2018
@codecov
Copy link

codecov bot commented Mar 29, 2018

Codecov Report

Merging #20538 into master will increase coverage by 0.02%.
The diff coverage is 66.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #20538      +/-   ##
==========================================
+ Coverage   91.81%   91.84%   +0.02%     
==========================================
  Files         152      153       +1     
  Lines       49259    49265       +6     
==========================================
+ Hits        45229    45245      +16     
+ Misses       4030     4020      -10
Flag Coverage Δ
#multiple 90.22% <66.66%> (+0.02%) ⬆️
#single 41.9% <33.33%> (+0.01%) ⬆️
Impacted Files Coverage Δ
pandas/util/_test_decorators.py 92% <100%> (+0.1%) ⬆️
pandas/plotting/_core.py 82.39% <62.5%> (-0.12%) ⬇️
pandas/io/clipboard/clipboards.py 30.58% <0%> (-1.6%) ⬇️
pandas/util/testing.py 84.52% <0%> (-0.21%) ⬇️
pandas/core/frame.py 97.15% <0%> (-0.03%) ⬇️
pandas/core/indexes/multi.py 95.05% <0%> (-0.01%) ⬇️
pandas/core/resample.py 96.43% <0%> (ø) ⬆️
pandas/io/formats/terminal.py 20.98% <0%> (ø) ⬆️
pandas/core/internals.py 95.53% <0%> (ø) ⬆️
... and 9 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 14889f1...b9f5bf6. Read the comment docs.

Copy link
Member

@jorisvandenbossche jorisvandenbossche left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@@ -160,6 +160,8 @@ def decorated_func(func):

skip_if_no_mpl = pytest.mark.skipif(_skip_if_no_mpl(),
reason="Missing matplotlib dependency")
skip_if_mpl = pytest.mark.skipif(not _skip_if_no_mpl(),
reason="matplotlib is pressent")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have a test build that does not have matplotlib ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pressent --> present

@@ -958,6 +958,7 @@ Offsets

Numeric
^^^^^^^
- Better error message when attempting to plot but matplotlib is not installed (:issue:`19810`).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move to Plotting section

@TomAugspurger
Copy link
Contributor Author

https://travis-ci.org/pandas-dev/pandas/jobs/360014203 doesn't include matplotlib, and should have run this.

@@ -17,6 +17,14 @@
from pandas.tests.plotting.common import TestPlotBase, _check_plot_works


@td.skip_if_mpl
def test_import_error_message():
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's reference the issue number here.

@@ -97,6 +98,9 @@ def __init__(self, data, kind=None, by=None, subplots=False, sharex=None,
secondary_y=False, colormap=None,
table=False, layout=None, **kwds):

if not _HAS_MPL:
raise ImportError("matplotlib is required for plotting.")
Copy link
Member

@gfyoung gfyoung Mar 30, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we just write a separate function for this check? You use this same code 4 times.

TomAugspurger and others added 2 commits April 2, 2018 09:12
* comment
* function
@jorisvandenbossche jorisvandenbossche merged commit eb168b7 into pandas-dev:master Apr 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants