Skip to content

test_time failure in CI logs #25875

Closed
Closed
@WillAyd

Description

@WillAyd

The following failure has shown up a couple times in CI today. Haven't looked in detail but assume it to be an unreliable test.

https://dev.azure.com/pandas-dev/pandas/_build/results?buildId=9836&view=logs&jobId=a69e7846-138e-5465-0656-921e8964615b&taskId=56da51de-fd5a-5466-5244-b5f65d252624&lineStart=42&lineEnd=95&colStart=1&colEnd=64

=================================== FAILURES ===================================
_____________________________ TestTSPlot.test_time _____________________________
[gw0] linux -- Python 3.6.6 /home/vsts/miniconda3/envs/pandas-dev/bin/python

self = <pandas.tests.plotting.test_datetimelike.TestTSPlot object at 0x7f2889f69978>

    @pytest.mark.slow
    def test_time(self):
        t = datetime(1, 1, 1, 3, 30, 0)
        deltas = np.random.randint(1, 20, 3).cumsum()
        ts = np.array([(t + timedelta(minutes=int(x))).time() for x in deltas])
        df = DataFrame({'a': np.random.randn(len(ts)),
                        'b': np.random.randn(len(ts))},
                       index=ts)
        fig, ax = self.plt.subplots()
        df.plot(ax=ax)
    
        # verify tick labels
        fig.canvas.draw()
        ticks = ax.get_xticks()
        labels = ax.get_xticklabels()
        for t, l in zip(ticks, labels):
            m, s = divmod(int(t), 60)
            h, m = divmod(m, 60)
            rs = l.get_text()
            if len(rs) > 0:
                if s != 0:
                    xp = time(h, m, s).strftime('%H:%M:%S')
                else:
                    xp = time(h, m, s).strftime('%H:%M')
                assert xp == rs
    
        # change xlim
        ax.set_xlim('1:30', '5:00')
    
        # check tick labels again
        fig.canvas.draw()
        ticks = ax.get_xticks()
        labels = ax.get_xticklabels()
        for t, l in zip(ticks, labels):
            m, s = divmod(int(t), 60)
            h, m = divmod(m, 60)
            rs = l.get_text()
            if len(rs) > 0:
                if s != 0:
                    xp = time(h, m, s).strftime('%H:%M:%S')
                else:
                    xp = time(h, m, s).strftime('%H:%M')
>               assert xp == rs
E               AssertionError: assert '01:06:40' == '03:40'
E                 - 01:06:40
E                 + 03:40

Metadata

Metadata

Assignees

No one assigned

    Labels

    CIContinuous IntegrationUnreliable TestUnit tests that occasionally fail

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions