From 6a8aee5f3faa41c1a2002d13fb729ae7fc599e19 Mon Sep 17 00:00:00 2001 From: Will Ayd Date: Wed, 27 Mar 2019 08:11:39 -0700 Subject: [PATCH 1/3] Skipped flaky part of test_time --- pandas/tests/plotting/test_datetimelike.py | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/pandas/tests/plotting/test_datetimelike.py b/pandas/tests/plotting/test_datetimelike.py index b8bcf83d8631b..8f81b47cc3ad2 100644 --- a/pandas/tests/plotting/test_datetimelike.py +++ b/pandas/tests/plotting/test_datetimelike.py @@ -1104,6 +1104,33 @@ def test_time(self): xp = time(h, m, s).strftime('%H:%M') assert xp == rs + @pytest.mark.slow + @pytest.mark.skip(reason="Unreliable test") + def test_time_change_xlim(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') From cbe48928ced9d23a41960146d0cf7a6a36ba36e6 Mon Sep 17 00:00:00 2001 From: Will Ayd Date: Wed, 27 Mar 2019 09:56:14 -0700 Subject: [PATCH 2/3] Changed skip to xfail --- pandas/tests/plotting/test_datetimelike.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/tests/plotting/test_datetimelike.py b/pandas/tests/plotting/test_datetimelike.py index 8f81b47cc3ad2..bf651e986f228 100644 --- a/pandas/tests/plotting/test_datetimelike.py +++ b/pandas/tests/plotting/test_datetimelike.py @@ -1105,7 +1105,7 @@ def test_time(self): assert xp == rs @pytest.mark.slow - @pytest.mark.skip(reason="Unreliable test") + @pytest.mark.xfail(reason="Unreliable test") def test_time_change_xlim(self): t = datetime(1, 1, 1, 3, 30, 0) deltas = np.random.randint(1, 20, 3).cumsum() From 2b9c032d65ae80f4760d1393c70dad7e4700ab97 Mon Sep 17 00:00:00 2001 From: Will Ayd Date: Wed, 27 Mar 2019 10:48:54 -0700 Subject: [PATCH 3/3] Added strict=False --- pandas/tests/plotting/test_datetimelike.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/tests/plotting/test_datetimelike.py b/pandas/tests/plotting/test_datetimelike.py index bf651e986f228..8d8330cf5b9a2 100644 --- a/pandas/tests/plotting/test_datetimelike.py +++ b/pandas/tests/plotting/test_datetimelike.py @@ -1105,7 +1105,7 @@ def test_time(self): assert xp == rs @pytest.mark.slow - @pytest.mark.xfail(reason="Unreliable test") + @pytest.mark.xfail(strict=False, reason="Unreliable test") def test_time_change_xlim(self): t = datetime(1, 1, 1, 3, 30, 0) deltas = np.random.randint(1, 20, 3).cumsum()