diff --git a/Tests/test_image_access.py b/Tests/test_image_access.py index 5bca08582..617274a57 100644 --- a/Tests/test_image_access.py +++ b/Tests/test_image_access.py @@ -1,4 +1,3 @@ -import ctypes import os import subprocess import sys @@ -404,6 +403,8 @@ class TestEmbeddable: "not from shell", ) def test_embeddable(self): + import ctypes + with open("embed_pil.c", "w") as fh: fh.write( """ diff --git a/Tests/test_imagewin_pointers.py b/Tests/test_imagewin_pointers.py index c51a66089..df1305655 100644 --- a/Tests/test_imagewin_pointers.py +++ b/Tests/test_imagewin_pointers.py @@ -1,4 +1,3 @@ -import ctypes from io import BytesIO from PIL import Image, ImageWin @@ -8,6 +7,7 @@ from .helper import hopper, is_win32 # see https://github.com/python-pillow/Pillow/pull/1431#issuecomment-144692652 if is_win32(): + import ctypes import ctypes.wintypes class BITMAPFILEHEADER(ctypes.Structure):