From 64d155bdfedfdea73db1f42a38274ea32b860742 Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Wed, 7 Aug 2019 15:10:41 +0200 Subject: [PATCH] No need to access filesystem in test_dates.py. --- lib/matplotlib/tests/test_dates.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/lib/matplotlib/tests/test_dates.py b/lib/matplotlib/tests/test_dates.py index d849c254aa86..6ec118b40d87 100644 --- a/lib/matplotlib/tests/test_dates.py +++ b/lib/matplotlib/tests/test_dates.py @@ -1,17 +1,16 @@ import datetime -import tempfile import dateutil.tz import dateutil.rrule import numpy as np import pytest -from matplotlib.testing.decorators import image_comparison -import matplotlib.pyplot as plt +from matplotlib import rc_context from matplotlib.cbook import MatplotlibDeprecationWarning import matplotlib.dates as mdates +import matplotlib.pyplot as plt +from matplotlib.testing.decorators import image_comparison import matplotlib.ticker as mticker -from matplotlib import rc_context def test_date_numpyx(): @@ -299,9 +298,8 @@ def test_empty_date_with_year_formatter(): yearFmt = dates.DateFormatter('%Y') ax.xaxis.set_major_formatter(yearFmt) - with tempfile.TemporaryFile() as fh: - with pytest.raises(ValueError): - fig.savefig(fh) + with pytest.raises(ValueError): + fig.canvas.draw() def test_auto_date_locator():