Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix test_imshow_pil on Windows. #14419

Merged
merged 1 commit into from Jun 7, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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