From 228613017bcfe886566ceec6a0b13499b9040bbc Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Sat, 28 Dec 2019 23:40:00 +1100 Subject: [PATCH] Added test if XCB is not present --- Tests/test_imagegrab.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Tests/test_imagegrab.py b/Tests/test_imagegrab.py index e25d90a36..253b4ec2a 100644 --- a/Tests/test_imagegrab.py +++ b/Tests/test_imagegrab.py @@ -34,6 +34,17 @@ class TestImageGrab: except IOError as e: pytest.skip(str(e)) + @pytest.mark.skipif(Image.core.HAVE_XCB, reason="tests missing XCB") + def test_grab_no_xcb(self): + if sys.platform not in ("win32", "darwin"): + with pytest.raises(IOError) as e: + ImageGrab.grab() + assert str(e.value).startswith("Pillow was built without XCB support") + + with pytest.raises(IOError) as e: + ImageGrab.grab(xdisplay="") + assert str(e.value).startswith("Pillow was built without XCB support") + @pytest.mark.skipif(not Image.core.HAVE_XCB, reason="requires XCB") def test_grab_invalid_xdisplay(self): with pytest.raises(IOError) as e: