Skip to content

Commit 15800e3

Browse files
committed
subprocess test
1 parent 9ff10fe commit 15800e3

File tree

2 files changed

+23
-4
lines changed

2 files changed

+23
-4
lines changed

pandas/plotting/_core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# This block will be eventually removed, but it's not clear when
1515
if pandas.get_option('plotting.matplotlib.register_converters'):
1616
try:
17-
from .misc import register
17+
from ._misc import register
1818
register(explicit=False)
1919
except ImportError:
2020
pass

pandas/tests/plotting/test_converter.py

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,30 @@
1212
from pandas import Index, Period, Series, Timestamp, date_range
1313
import pandas.util.testing as tm
1414

15+
from pandas.plotting import (
16+
deregister_matplotlib_converters, register_matplotlib_converters)
1517
from pandas.tseries.offsets import Day, Micro, Milli, Second
1618

17-
converter = pytest.importorskip('pandas.plotting._matplotlib.converter')
18-
from pandas.plotting import (deregister_matplotlib_converters, # isort:skip
19-
register_matplotlib_converters)
19+
try:
20+
from pandas.plotting._matplotlib import converter
21+
except ImportError:
22+
# try / except, rather than skip, to avoid internal refactoring
23+
# causing an improprer skip
24+
pass
25+
26+
pytest.importorskip('matplotlib.pyplot')
27+
28+
29+
def test_initial_warning():
30+
code = (
31+
"import pandas as pd; import matplotlib.pyplot as plt; "
32+
"s = pd.Series(1, pd.date_range('2000', periods=12)); "
33+
"fig, ax = plt.subplots(); "
34+
"ax.plot(s.index, s.values)"
35+
)
36+
call = [sys.executable, '-c', code]
37+
out = subprocess.check_output(call, stderr=subprocess.STDOUT).decode()
38+
assert 'Using an implicitly' in out
2039

2140

2241
def test_timtetonum_accepts_unicode():

0 commit comments

Comments
 (0)