mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-08-21 12:44:46 +03:00
skip ImageGrab test on Windows in Docker
This commit is contained in:
parent
a7c3f126ed
commit
c09461103a
|
@ -282,6 +282,19 @@ def is_win32():
|
||||||
return sys.platform.startswith("win32")
|
return sys.platform.startswith("win32")
|
||||||
|
|
||||||
|
|
||||||
|
def is_win32_docker():
|
||||||
|
try:
|
||||||
|
import winreg
|
||||||
|
|
||||||
|
key = winreg.OpenKey(
|
||||||
|
winreg.HKEY_LOCAL_MACHINE, r"SYSTEM\CurrentControlSet\Control"
|
||||||
|
)
|
||||||
|
winreg.QueryValueEx(key, "ContainerType") # fails if not in Docker container
|
||||||
|
return True
|
||||||
|
except (ImportError, OSError):
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
def is_pypy():
|
def is_pypy():
|
||||||
return hasattr(sys, "pypy_translation_info")
|
return hasattr(sys, "pypy_translation_info")
|
||||||
|
|
||||||
|
|
|
@ -6,13 +6,19 @@ import pytest
|
||||||
|
|
||||||
from PIL import Image, ImageGrab
|
from PIL import Image, ImageGrab
|
||||||
|
|
||||||
from .helper import assert_image, assert_image_equal_tofile, skip_unless_feature
|
from .helper import (
|
||||||
|
assert_image,
|
||||||
|
assert_image_equal_tofile,
|
||||||
|
is_win32_docker,
|
||||||
|
skip_unless_feature,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class TestImageGrab:
|
class TestImageGrab:
|
||||||
@pytest.mark.skipif(
|
@pytest.mark.skipif(
|
||||||
sys.platform not in ("win32", "darwin"), reason="requires Windows or macOS"
|
sys.platform not in ("win32", "darwin"), reason="requires Windows or macOS"
|
||||||
)
|
)
|
||||||
|
@pytest.mark.skipif(is_win32_docker(), reason="running on headless Windows")
|
||||||
def test_grab(self):
|
def test_grab(self):
|
||||||
for im in [
|
for im in [
|
||||||
ImageGrab.grab(),
|
ImageGrab.grab(),
|
||||||
|
|
Loading…
Reference in New Issue
Block a user