Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6cd8a00

Browse files
committed
Skip test if PIL can't be imported
1 parent d6dc2c7 commit 6cd8a00

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

lib/matplotlib/tests/test_agg.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import numpy as np
88
from numpy.testing import assert_array_almost_equal
99
import pytest
10-
from PIL import Image
1110

1211
from matplotlib.image import imread
1312
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
@@ -239,6 +238,10 @@ def test_chunksize():
239238

240239
@pytest.mark.backend('Agg')
241240
def test_jpeg_dpi():
241+
try:
242+
from PIL import Image
243+
except Exception:
244+
pytest.skip("Could not import PIL")
242245
# Check that dpi is set correctly in jpg files
243246
plt.plot([0, 1, 2], [0, 1, 0])
244247
plt.savefig('test.jpg', dpi=200)

0 commit comments

Comments
 (0)