8000 Skip test if PIL can't be imported · matplotlib/matplotlib@a2a17e9 · GitHub
[go: up one dir, main page]

Skip to content

Commit a2a17e9

Browse files
committed
Skip test if PIL can't be imported
1 parent d474953 commit a2a17e9

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

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)
0