From 97450688333549b0874a67044a31db4abfb5732c Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Mon, 10 Dec 2018 23:40:14 +0100 Subject: [PATCH] Remove some checks for Py<3.6 in the test suite. --- lib/matplotlib/tests/test_backend_pdf.py | 3 +-- lib/matplotlib/tests/test_figure.py | 5 ++--- lib/matplotlib/tests/test_image.py | 5 +---- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/lib/matplotlib/tests/test_backend_pdf.py b/lib/matplotlib/tests/test_backend_pdf.py index 04102640ff7b..8eddf1597af2 100644 --- a/lib/matplotlib/tests/test_backend_pdf.py +++ b/lib/matplotlib/tests/test_backend_pdf.py @@ -1,5 +1,6 @@ import io import os +from pathlib import Path import sys import tempfile import warnings @@ -132,9 +133,7 @@ def test_composite_image(): assert len(pdf._file._images) == 2 -@pytest.mark.skipif(sys.version_info < (3, 6), reason="requires Python 3.6+") def test_pdfpages_fspath(): - from pathlib import Path with PdfPages(Path(os.devnull)) as pdf: pdf.savefig(plt.figure()) diff --git a/lib/matplotlib/tests/test_figure.py b/lib/matplotlib/tests/test_figure.py index 7cb5af621450..a33ab9348ae7 100644 --- a/lib/matplotlib/tests/test_figure.py +++ b/lib/matplotlib/tests/test_figure.py @@ -1,6 +1,7 @@ +from pathlib import Path +import platform import sys import warnings -import platform from matplotlib import rcParams from matplotlib.testing.decorators import image_comparison, check_figures_equal @@ -412,10 +413,8 @@ def test_add_artist(fig_test, fig_ref): ax2.add_artist(a) -@pytest.mark.skipif(sys.version_info < (3, 6), reason="requires Python 3.6+") @pytest.mark.parametrize("fmt", ["png", "pdf", "ps", "eps", "svg"]) def test_fspath(fmt, tmpdir): - from pathlib import Path out = Path(tmpdir, "test.{}".format(fmt)) plt.savefig(out) with out.open("rb") as file: diff --git a/lib/matplotlib/tests/test_image.py b/lib/matplotlib/tests/test_image.py index 800895067db5..af26c3130ae7 100644 --- a/lib/matplotlib/tests/test_image.py +++ b/lib/matplotlib/tests/test_image.py @@ -3,6 +3,7 @@ import io import os import sys +from pathlib import Path import platform import urllib.request import warnings @@ -112,10 +113,8 @@ def test_imread_pil_uint16(): assert np.sum(img) == 134184960 -@pytest.mark.skipif(sys.version_info < (3, 6), reason="requires Python 3.6+") def test_imread_fspath(): pytest.importorskip("PIL") - from pathlib import Path img = plt.imread( Path(__file__).parent / 'baseline_images/test_image/uint16.tif') assert img.dtype == np.uint16 @@ -151,10 +150,8 @@ def test_imsave(): assert_array_equal(arr_dpi1, arr_dpi100) -@pytest.mark.skipif(sys.version_info < (3, 6), reason="requires Python 3.6+") @pytest.mark.parametrize("fmt", ["png", "pdf", "ps", "eps", "svg"]) def test_imsave_fspath(fmt): - Path = pytest.importorskip("pathlib").Path plt.imsave(Path(os.devnull), np.array([[0, 1]]), format=fmt)