Skip to content

Commit

Permalink
Merge pull request #14419 from anntzer/imshowpilpath
Browse files Browse the repository at this point in the history
Fix test_imshow_pil on Windows.
  • Loading branch information
dstansby committed Jun 7, 2019
2 parents 59d2df7 + 7930b43 commit f803777
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/matplotlib/tests/test_image.py
Expand Up @@ -119,13 +119,17 @@ def test_image_python_io():
def test_imshow_pil(fig_test, fig_ref):
style.use("default")
PIL = pytest.importorskip("PIL")
png_path = Path(__file__).parent / "baseline_images/pngsuite/basn3p04.png"
tiff_path = Path(__file__).parent / "baseline_images/test_image/uint16.tif"
# Pillow<=6.0 fails to open pathlib.Paths on Windows (pillow#3823), and
# Matplotlib's builtin png opener doesn't handle them either.
png_path = str(
Path(__file__).parent / "baseline_images/pngsuite/basn3p04.png")
tiff_path = str(
Path(__file__).parent / "baseline_images/test_image/uint16.tif")
axs = fig_test.subplots(2)
axs[0].imshow(PIL.Image.open(png_path))
axs[1].imshow(PIL.Image.open(tiff_path))
axs = fig_ref.subplots(2)
axs[0].imshow(plt.imread(str(png_path)))
axs[0].imshow(plt.imread(png_path))
axs[1].imshow(plt.imread(tiff_path))


Expand Down

0 comments on commit f803777

Please sign in to comment.