Skip to content

Commit dc41a4e

Browse files
committed
use skip_unless_feature in more tests
1 parent fc92f56 commit dc41a4e

2 files changed

Lines changed: 5 additions & 7 deletions

File tree

Tests/test_image_reduce.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import pytest
22
from PIL import Image, ImageMath, ImageMode
33

4-
from .helper import convert_to_comparable
4+
from .helper import convert_to_comparable, skip_unless_feature
55

66
codecs = dir(Image.core)
77

@@ -254,9 +254,7 @@ def test_mode_F():
254254
compare_reduce_with_box(im, factor)
255255

256256

257-
@pytest.mark.skipif(
258-
"jpeg2k_decoder" not in codecs, reason="JPEG 2000 support not available"
259-
)
257+
@skip_unless_feature("jpg_2000")
260258
def test_jpeg2k():
261259
with Image.open("Tests/images/test-card-lossless.jp2") as im:
262260
assert im.reduce(2).size == (320, 240)

Tests/test_imagegrab.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import pytest
55
from PIL import Image, ImageGrab
66

7-
from .helper import assert_image
7+
from .helper import assert_image, skip_unless_feature
88

99

1010
class TestImageGrab:
@@ -22,7 +22,7 @@ def test_grab(self):
2222
im = ImageGrab.grab(bbox=(10, 20, 50, 80))
2323
assert_image(im, im.mode, (40, 60))
2424

25-
@pytest.mark.skipif(not Image.core.HAVE_XCB, reason="requires XCB")
25+
@skip_unless_feature("xcb")
2626
def test_grab_x11(self):
2727
try:
2828
if sys.platform not in ("win32", "darwin"):
@@ -45,7 +45,7 @@ def test_grab_no_xcb(self):
4545
ImageGrab.grab(xdisplay="")
4646
assert str(e.value).startswith("Pillow was built without XCB support")
4747

48-
@pytest.mark.skipif(not Image.core.HAVE_XCB, reason="requires XCB")
48+
@skip_unless_feature("xcb")
4949
def test_grab_invalid_xdisplay(self):
5050
with pytest.raises(OSError) as e:
5151
ImageGrab.grab(xdisplay="error.test:0.0")

0 commit comments

Comments
 (0)