Merge pull request #6712 from radarhere/imagegrab

XCB will not be used by default on Linux if gnome-screenshot is present
This commit is contained in:
Hugo van Kemenade 2022-11-02 09:30:50 +02:00 committed by GitHub
commit aedbc77618
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,4 +1,5 @@
import os
import shutil
import subprocess
import sys
@ -33,7 +34,9 @@ class TestImageGrab:
@pytest.mark.skipif(Image.core.HAVE_XCB, reason="tests missing XCB")
def test_grab_no_xcb(self):
if sys.platform not in ("win32", "darwin"):
if sys.platform not in ("win32", "darwin") and not shutil.which(
"gnome-screenshot"
):
with pytest.raises(OSError) as e:
ImageGrab.grab()
assert str(e.value).startswith("Pillow was built without XCB support")