From 43896485c0a7e6b27d1f54223bd55092fc179fe4 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Tue, 31 Mar 2020 00:12:38 -0400 Subject: [PATCH] TST: don't actually render 1k+ date ticks It is enough to ask the locator what ticks it would have (without trying to render them all) --- lib/matplotlib/tests/test_dates.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/matplotlib/tests/test_dates.py b/lib/matplotlib/tests/test_dates.py index 041615d483a6..b9bda2e3666e 100644 --- a/lib/matplotlib/tests/test_dates.py +++ b/lib/matplotlib/tests/test_dates.py @@ -152,13 +152,15 @@ def test_too_many_date_ticks(caplog): 'Attempting to set identical left == right' in str(rec[0].message) ax.plot([], []) ax.xaxis.set_major_locator(mdates.DayLocator()) - fig.canvas.draw() + v = ax.xaxis.get_major_locator()() + assert len(v) > 1000 # The warning is emitted multiple times because the major locator is also # called both when placing the minor ticks (for overstriking detection) and # during tick label positioning. assert caplog.records and all( record.name == "matplotlib.ticker" and record.levelname == "WARNING" for record in caplog.records) + assert len(caplog.records) > 0 @image_comparison(['RRuleLocator_bounds.png'])