Skip to content

Checking plot labels works locally but not during CI #31580

Closed
@MarcoGorelli

Description

@MarcoGorelli

Code Sample, a copy-pastable example if possible

xref #31207

If I modified the test as follows (with import re at the top of the file)

        with tm.assert_produces_warning(None):
            fig, ax = self.plt.subplots()
            ts.plot(ax=ax)
            fig.canvas.draw()
            labels = [i.get_text() for i in ax.get_xticklabels()]
            # Extract H:M component, check first point is in correct timezone.
            # NOTE: this test could be updated once GH 31548 is fixed,
            # so that the last point is checked as well.
            assert re.findall(r"[^:]?(\d{2}:\d{2})", labels[0])[0] == "00:00"
            _check_plot_works(ts.plot)

then the test worked locally, but not during CI. Looking at the job details for linux py36_local, I could see that labels was

['01 00:01', ...1 00:51', ...]

I don't understand where that extra minute is coming from (nor can I understand why it only appears during CI).

Output of pd.show_versions()

[paste the output of pd.show_versions() here below this line]
INSTALLED VERSIONS

commit : 6e2d3ae
python : 3.7.6.final.0
python-bits : 64
OS : Linux
OS-release : 4.15.0-74-generic
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : en_GB.UTF-8
LOCALE : en_GB.UTF-8

pandas : 0.26.0.dev0+2036.g6e2d3aeb6
numpy : 1.17.3
pytz : 2019.3
dateutil : 2.8.1
pip : 19.3.1
setuptools : 45.0.0.post20200113
Cython : 0.29.14
pytest : 5.3.3
hypothesis : 5.1.5
sphinx : 2.3.1
blosc : None
feather : None
xlsxwriter : 1.2.7
lxml.etree : 4.4.2
html5lib : 1.0.1
pymysql : None
psycopg2 : None
jinja2 : 2.10.3
IPython : 7.11.1
pandas_datareader: None
bs4 : 4.8.2
bottleneck : 1.3.1
fastparquet : 0.3.2
gcsfs : None
lxml.etree : 4.4.2
matplotlib : 3.1.2
numexpr : 2.7.1
odfpy : None
openpyxl : 3.0.1
pandas_gbq : None
pyarrow : 0.15.1
pytables : None
pytest : 5.3.3
pyxlsb : None
s3fs : 0.4.0
scipy : 1.4.1
sqlalchemy : 1.3.12
tables : 3.6.1
tabulate : 0.8.6
xarray : 0.14.1
xlrd : 1.2.0
xlwt : 1.3.0
xlsxwriter : 1.2.7
numba : 0.47.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Testingpandas testing functions or related to the test suiteVisualizationplotting

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions