Skip to content

Local test failure plotting.test_datetimelike.test_ts_plot_with_tz #32331

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

Closed
ShaharNaveh opened this issue Feb 28, 2020 · 6 comments
Closed

Local test failure plotting.test_datetimelike.test_ts_plot_with_tz #32331

ShaharNaveh opened this issue Feb 28, 2020 · 6 comments
Labels
Unreliable Test Unit tests that occasionally fail Visualization plotting

Comments

@ShaharNaveh
Copy link
Member

After running:

(venv-pandas) $ pytest pandas/tests/plotting/test_datetimelike.py -k "test_ts_plot_with_tz"

I got a test failure.

Test log:

================================================== FAILURES ==================================================
___________________________________ TestTSPlot.test_ts_plot_with_tz['UTC'] ___________________________________

self = <pandas.tests.plotting.test_datetimelike.TestTSPlot object at 0x63f623915bb0>, tz_aware_fixture = 'UTC'

    @pytest.mark.slow
    def test_ts_plot_with_tz(self, tz_aware_fixture):
        # GH2877, GH17173, GH31205, GH31580
        tz = tz_aware_fixture
        index = date_range("1/1/2011", periods=2, freq="H", tz=tz)
        ts = Series([188.5, 328.25], index=index)
        with tm.assert_produces_warning(None):
            _check_plot_works(ts.plot)
            ax = ts.plot()
            xdata = list(ax.get_lines())[0].get_xdata()
            # Check first and last points' labels are correct
>           assert (xdata[0].hour, xdata[0].minute) == (0, 0)
E           AttributeError: 'numpy.datetime64' object has no attribute 'hour'

pandas/tests/plotting/test_datetimelike.py:57: AttributeError

Output of pd.show_versions():

INSTALLED VERSIONS

commit : 4e5e73e
python : 3.8.1.final.0
python-bits : 64
OS : Linux
OS-release : 5.4.19.a-1-hardened
machine : x86_64
processor :
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8

pandas : 1.1.0.dev0+635.g4e5e73e23
numpy : 1.18.1
pytz : 2019.3
dateutil : 2.8.1
pip : 20.0.2
setuptools : 45.2.0
Cython : 0.29.15
pytest : 5.3.5
hypothesis : 5.5.4
sphinx : 2.4.3
blosc : 1.8.3
feather : None
xlsxwriter : 1.2.8
lxml.etree : 4.5.0
html5lib : 1.0.1
pymysql : None
psycopg2 : None
jinja2 : 2.11.1
IPython : 7.12.0
pandas_datareader: None
bs4 : 4.8.2
bottleneck : 1.3.2
fastparquet : 0.3.3
gcsfs : None
lxml.etree : 4.5.0
matplotlib : 3.1.3
numexpr : 2.7.1
odfpy : None
openpyxl : 3.0.1
pandas_gbq : None
pyarrow : 0.16.0
pytables : None
pytest : 5.3.5
pyxlsb : None
s3fs : 0.4.0
scipy : 1.4.1
sqlalchemy : 1.3.13
tables : 3.6.1
tabulate : 0.8.6
xarray : 0.15.0
xlrd : 1.2.0
xlwt : 1.3.0
xlsxwriter : 1.2.8
numba : 0.48.0

@ShaharNaveh
Copy link
Member Author

Update

I could not manage to reproduce this issue.


Are there times when np.datetime64 doesn't have an hour attribute?

@jbrockmendel jbrockmendel added Unreliable Test Unit tests that occasionally fail Visualization plotting labels Feb 28, 2020
@mroeschke
Copy link
Member

Is this still failing for you @MomIsBestFriend? Closable?

@mroeschke
Copy link
Member

Worked for me locally on MacOS

(pandas-dev) matthewroeschke:pandas-mroeschke matthewroeschke$ pytest pandas/tests/plotting/test_datetimelike.py -k "test_ts_plot_with_tz"
=============================================================================== test session starts ===============================================================================
platform darwin -- Python 3.7.6, pytest-5.4.1, py-1.8.1, pluggy-0.13.0
rootdir: /Users/matthewroeschke/pandas-mroeschke, inifile: setup.cfg
plugins: hypothesis-5.8.0, asyncio-0.10.0, forked-1.1.2, xdist-1.31.0, cov-2.8.1
collected 106 items / 93 deselected / 13 selected

pandas/tests/plotting/test_datetimelike.py .............                                                                                                                    [100%]

======================================================================== 13 passed, 93 deselected in 2.36s ========================================================================

@rivera-fernando
Copy link

rivera-fernando commented May 19, 2020

@mroeschke I too pass using the same command as you on MacOS

pytest pandas/tests/plotting/test_datetimelike.py -k "test_ts_plot_with_tz"                       
==================================================================== test session starts =====================================================================
platform darwin -- Python 3.8.2, pytest-5.4.2, py-1.8.1, pluggy-0.13.1
rootdir: /Users/fernandorivera/Documents/pandas-fernando, inifile: setup.cfg
plugins: asyncio-0.12.0, hypothesis-5.14.0, forked-1.1.2, xdist-1.32.0, cov-2.8.1
collected 106 items / 93 deselected / 13 selected

pandas/tests/plotting/test_datetimelike.py .............                                                                                               [100%]

============================================================= 13 passed, 93 deselected in 1.99s ==============================================================

but when simply running

pytest pandas/tests/plotting

then pandas/tests/plotting/test_datetimelike.py fails the first test

UPDATE:
I get this failure

========================================================================== FAILURES ==========================================================================
___________________________________________________________ TestTSPlot.test_ts_plot_with_tz['UTC'] ___________________________________________________________

self = <pandas.tests.plotting.test_datetimelike.TestTSPlot object at 0x7fe172b18b80>, tz_aware_fixture = 'UTC'

    @pytest.mark.slow
    def test_ts_plot_with_tz(self, tz_aware_fixture):
        # GH2877, GH17173, GH31205, GH31580
        tz = tz_aware_fixture
        index = date_range("1/1/2011", periods=2, freq="H", tz=tz)
        ts = Series([188.5, 328.25], index=index)
        with tm.assert_produces_warning(None):
            _check_plot_works(ts.plot)
            ax = ts.plot()
            xdata = list(ax.get_lines())[0].get_xdata()
            # Check first and last points' labels are correct
>           assert (xdata[0].hour, xdata[0].minute) == (0, 0)
E           AttributeError: 'numpy.datetime64' object has no attribute 'hour'

pandas/tests/plotting/test_datetimelike.py:57: AttributeError

@cvanweelden
Copy link
Contributor

I ran into this issue on my local pandas-dev env.

It passes if I run only this test file:

pytest pandas/tests/plotting/test_datetimelike.py

But it fails if I run all plotting tests:

pytest pandas/tests/plotting/

With the following error:

________________________________________________________ TestTSPlot.test_ts_plot_with_tz['UTC'] __________________________________________________________________________________

self = <pandas.tests.plotting.test_datetimelike.TestTSPlot object at 0x7f3e6cc3ebe0>, tz_aware_fixture = 'UTC'

    @pytest.mark.slow
    def test_ts_plot_with_tz(self, tz_aware_fixture):
        # GH2877, GH17173, GH31205, GH31580
        tz = tz_aware_fixture
        index = date_range("1/1/2011", periods=2, freq="H", tz=tz)
        ts = Series([188.5, 328.25], index=index)
        with tm.assert_produces_warning(None):
            _check_plot_works(ts.plot)
            ax = ts.plot()
            xdata = list(ax.get_lines())[0].get_xdata()
            # Check first and last points' labels are correct
>           assert (xdata[0].hour, xdata[0].minute) == (0, 0)
E           AttributeError: 'numpy.datetime64' object has no attribute 'hour'

pandas/tests/plotting/test_datetimelike.py:58: AttributeError

This is reproducible for me and was on latest master (b57e5cc)

Output of pd.show_versions()

INSTALLED VERSIONS

commit : b57e5cc
python : 3.8.3.final.0
python-bits : 64
OS : Linux
OS-release : 4.15.0-106-generic
Version : #107-Ubuntu SMP Thu Jun 4 11:27:52 UTC 2020
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8

pandas : 1.1.0.dev0+1904.gb57e5ccf6
numpy : 1.18.5
pytz : 2020.1
dateutil : 2.8.1
pip : 20.1.1
setuptools : 47.3.1.post20200616
Cython : 0.29.20
pytest : 5.4.3
hypothesis : 5.16.2
sphinx : 3.1.1
blosc : None
feather : None
xlsxwriter : 1.2.9
lxml.etree : 4.5.1
html5lib : 1.0.1
pymysql : None
psycopg2 : None
jinja2 : 2.11.2
IPython : 7.15.0
pandas_datareader: None
bs4 : 4.9.1
bottleneck : 1.3.2
fastparquet : 0.4.0
gcsfs : None
matplotlib : 3.2.2
numexpr : 2.7.1
odfpy : None
openpyxl : 3.0.3
pandas_gbq : None
pyarrow : 0.17.1
pytables : None
pyxlsb : None
s3fs : 0.4.2
scipy : 1.4.1
sqlalchemy : 1.3.17
tables : 3.6.1
tabulate : 0.8.7
xarray : 0.15.1
xlrd : 1.2.0
xlwt : 1.3.0
numba : 0.48.0

@mroeschke
Copy link
Member

Going to close this issue in favor of #35080 as it looks like that issue is further along in investigating that root cause.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Unreliable Test Unit tests that occasionally fail Visualization plotting
Projects
None yet
Development

No branches or pull requests

5 participants