Skip to content

Commit b26ee6b

Browse files
committed
Remove dependency on pillow and instead delegate to Matplotlib's imread
1 parent 7be0270 commit b26ee6b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pytest_mpl/plugin.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,8 @@ def pytest_runtest_setup(self, item):
194194
if compare is None:
195195
return
196196

197-
from PIL import Image
198197
import matplotlib
198+
from matplotlib.image import imread
199199
import matplotlib.pyplot as plt
200200
from matplotlib.testing.compare import compare_images
201201
try:
@@ -291,8 +291,8 @@ def item_function_wrapper(*args, **kwargs):
291291
# Compare image size ourselves since the Matplotlib
292292
# exception is a bit cryptic in this case and doesn't show
293293
# the filenames
294-
expected_shape = Image.open(baseline_image).size
295-
actual_shape = Image.open(test_image).size
294+
expected_shape = imread(baseline_image).shape[:2]
295+
actual_shape = imread(test_image).shape[:2]
296296
if expected_shape != actual_shape:
297297
error = SHAPE_MISMATCH_ERROR.format(expected_path=baseline_image,
298298
expected_shape=expected_shape,

0 commit comments

Comments
 (0)