2023-12-21 14:13:31 +03:00
|
|
|
from __future__ import annotations
|
2024-01-20 14:23:03 +03:00
|
|
|
|
2019-07-06 23:40:53 +03:00
|
|
|
import os
|
2019-10-07 16:28:36 +03:00
|
|
|
import subprocess
|
2019-07-06 23:40:53 +03:00
|
|
|
import sys
|
2020-09-01 20:16:46 +03:00
|
|
|
import sysconfig
|
2024-02-12 01:28:53 +03:00
|
|
|
from types import ModuleType
|
2014-01-05 22:41:25 +04:00
|
|
|
|
2020-02-22 16:06:21 +03:00
|
|
|
import pytest
|
2020-09-01 20:16:46 +03:00
|
|
|
|
2014-06-10 13:10:47 +04:00
|
|
|
from PIL import Image
|
2019-07-06 23:40:53 +03:00
|
|
|
|
2024-05-12 14:20:46 +03:00
|
|
|
from .helper import assert_image_equal, hopper, is_win32
|
2014-01-05 22:41:25 +04:00
|
|
|
|
2024-02-12 01:28:53 +03:00
|
|
|
numpy: ModuleType | None
|
2021-01-14 13:31:25 +03:00
|
|
|
try:
|
|
|
|
import numpy
|
|
|
|
except ImportError:
|
|
|
|
numpy = None
|
|
|
|
|
2018-03-03 12:54:00 +03:00
|
|
|
|
2024-06-29 08:02:50 +03:00
|
|
|
class TestImagePutPixel:
|
2024-01-31 12:12:58 +03:00
|
|
|
def test_sanity(self) -> None:
|
2016-07-03 04:33:14 +03:00
|
|
|
im1 = hopper()
|
|
|
|
im2 = Image.new(im1.mode, im1.size, 0)
|
|
|
|
|
|
|
|
for y in range(im1.size[1]):
|
|
|
|
for x in range(im1.size[0]):
|
|
|
|
pos = x, y
|
2024-07-05 20:56:24 +03:00
|
|
|
value = im1.getpixel(pos)
|
|
|
|
assert value is not None
|
|
|
|
im2.putpixel(pos, value)
|
2016-07-03 04:33:14 +03:00
|
|
|
|
2020-01-30 17:56:07 +03:00
|
|
|
assert_image_equal(im1, im2)
|
2016-07-03 04:33:14 +03:00
|
|
|
|
|
|
|
im2 = Image.new(im1.mode, im1.size, 0)
|
|
|
|
im2.readonly = 1
|
|
|
|
|
|
|
|
for y in range(im1.size[1]):
|
|
|
|
for x in range(im1.size[0]):
|
|
|
|
pos = x, y
|
2024-07-05 20:56:24 +03:00
|
|
|
value = im1.getpixel(pos)
|
|
|
|
assert value is not None
|
|
|
|
im2.putpixel(pos, value)
|
2016-07-03 04:33:14 +03:00
|
|
|
|
2020-02-22 16:06:21 +03:00
|
|
|
assert not im2.readonly
|
2020-01-30 17:56:07 +03:00
|
|
|
assert_image_equal(im1, im2)
|
2016-07-03 04:33:14 +03:00
|
|
|
|
|
|
|
im2 = Image.new(im1.mode, im1.size, 0)
|
|
|
|
|
|
|
|
pix1 = im1.load()
|
|
|
|
pix2 = im2.load()
|
|
|
|
|
2024-07-02 13:10:47 +03:00
|
|
|
assert pix1 is not None
|
|
|
|
assert pix2 is not None
|
2024-02-12 01:28:53 +03:00
|
|
|
with pytest.raises(TypeError):
|
2024-07-05 20:56:24 +03:00
|
|
|
pix1[0, "0"] # type: ignore[index]
|
2024-02-12 01:28:53 +03:00
|
|
|
with pytest.raises(TypeError):
|
2024-07-05 20:56:24 +03:00
|
|
|
pix1["0", 0] # type: ignore[index]
|
2021-01-14 14:09:11 +03:00
|
|
|
|
2016-07-03 04:33:14 +03:00
|
|
|
for y in range(im1.size[1]):
|
|
|
|
for x in range(im1.size[0]):
|
|
|
|
pix2[x, y] = pix1[x, y]
|
|
|
|
|
2020-01-30 17:56:07 +03:00
|
|
|
assert_image_equal(im1, im2)
|
2016-07-03 04:33:14 +03:00
|
|
|
|
2024-01-31 12:12:58 +03:00
|
|
|
def test_sanity_negative_index(self) -> None:
|
2018-10-15 13:51:24 +03:00
|
|
|
im1 = hopper()
|
|
|
|
im2 = Image.new(im1.mode, im1.size, 0)
|
|
|
|
|
2018-10-15 14:06:08 +03:00
|
|
|
width, height = im1.size
|
2020-02-22 16:06:21 +03:00
|
|
|
assert im1.getpixel((0, 0)) == im1.getpixel((-width, -height))
|
|
|
|
assert im1.getpixel((-1, -1)) == im1.getpixel((width - 1, height - 1))
|
2018-10-15 13:51:24 +03:00
|
|
|
|
2019-06-13 18:54:24 +03:00
|
|
|
for y in range(-1, -im1.size[1] - 1, -1):
|
|
|
|
for x in range(-1, -im1.size[0] - 1, -1):
|
2018-10-15 13:51:24 +03:00
|
|
|
pos = x, y
|
2024-07-05 20:56:24 +03:00
|
|
|
value = im1.getpixel(pos)
|
|
|
|
assert value is not None
|
|
|
|
im2.putpixel(pos, value)
|
2018-10-15 13:51:24 +03:00
|
|
|
|
2020-01-30 17:56:07 +03:00
|
|
|
assert_image_equal(im1, im2)
|
2018-10-15 13:51:24 +03:00
|
|
|
|
|
|
|
im2 = Image.new(im1.mode, im1.size, 0)
|
|
|
|
im2.readonly = 1
|
|
|
|
|
2019-06-13 18:54:24 +03:00
|
|
|
for y in range(-1, -im1.size[1] - 1, -1):
|
|
|
|
for x in range(-1, -im1.size[0] - 1, -1):
|
2018-10-15 13:51:24 +03:00
|
|
|
pos = x, y
|
2024-07-05 20:56:24 +03:00
|
|
|
value = im1.getpixel(pos)
|
|
|
|
assert value is not None
|
|
|
|
im2.putpixel(pos, value)
|
2018-10-15 13:51:24 +03:00
|
|
|
|
2020-02-22 16:06:21 +03:00
|
|
|
assert not im2.readonly
|
2020-01-30 17:56:07 +03:00
|
|
|
assert_image_equal(im1, im2)
|
2018-10-15 13:51:24 +03:00
|
|
|
|
|
|
|
im2 = Image.new(im1.mode, im1.size, 0)
|
|
|
|
|
|
|
|
pix1 = im1.load()
|
|
|
|
pix2 = im2.load()
|
|
|
|
|
2024-07-02 13:10:47 +03:00
|
|
|
assert pix1 is not None
|
|
|
|
assert pix2 is not None
|
2019-06-13 18:54:24 +03:00
|
|
|
for y in range(-1, -im1.size[1] - 1, -1):
|
|
|
|
for x in range(-1, -im1.size[0] - 1, -1):
|
2018-10-15 13:51:24 +03:00
|
|
|
pix2[x, y] = pix1[x, y]
|
|
|
|
|
2020-01-30 17:56:07 +03:00
|
|
|
assert_image_equal(im1, im2)
|
2016-07-03 04:33:14 +03:00
|
|
|
|
2021-01-14 13:31:25 +03:00
|
|
|
@pytest.mark.skipif(numpy is None, reason="NumPy not installed")
|
2024-01-31 12:12:58 +03:00
|
|
|
def test_numpy(self) -> None:
|
2021-01-14 13:31:25 +03:00
|
|
|
im = hopper()
|
2024-07-02 13:10:47 +03:00
|
|
|
px = im.load()
|
2021-01-14 13:31:25 +03:00
|
|
|
|
2024-07-02 13:10:47 +03:00
|
|
|
assert px is not None
|
2024-02-12 01:28:53 +03:00
|
|
|
assert numpy is not None
|
2024-07-02 13:10:47 +03:00
|
|
|
assert px[numpy.int32(1), numpy.int32(2)] == (18, 20, 59)
|
2021-01-14 13:31:25 +03:00
|
|
|
|
2018-11-11 19:57:57 +03:00
|
|
|
|
2024-06-29 08:02:50 +03:00
|
|
|
class TestImageGetPixel:
|
2016-07-03 04:33:14 +03:00
|
|
|
@staticmethod
|
2024-02-12 01:28:53 +03:00
|
|
|
def color(mode: str) -> int | tuple[int, ...]:
|
2016-07-03 04:33:14 +03:00
|
|
|
bands = Image.getmodebands(mode)
|
|
|
|
if bands == 1:
|
|
|
|
return 1
|
2023-07-26 05:25:54 +03:00
|
|
|
if mode in ("BGR;15", "BGR;16"):
|
2024-04-01 07:29:01 +03:00
|
|
|
# These modes have less than 8 bits per band,
|
|
|
|
# so (1, 2, 3) cannot be roundtripped.
|
2023-07-26 05:25:54 +03:00
|
|
|
return (16, 32, 49)
|
2022-10-13 05:20:11 +03:00
|
|
|
return tuple(range(1, bands + 1))
|
2016-07-03 04:33:14 +03:00
|
|
|
|
2024-02-12 01:28:53 +03:00
|
|
|
def check(self, mode: str, expected_color_int: int | None = None) -> None:
|
|
|
|
expected_color = (
|
2024-02-12 11:12:08 +03:00
|
|
|
self.color(mode) if expected_color_int is None else expected_color_int
|
2024-02-12 01:28:53 +03:00
|
|
|
)
|
2016-07-03 04:33:14 +03:00
|
|
|
|
2024-04-25 16:51:33 +03:00
|
|
|
# Check putpixel
|
2016-07-03 04:33:14 +03:00
|
|
|
im = Image.new(mode, (1, 1), None)
|
2023-01-16 16:46:11 +03:00
|
|
|
im.putpixel((0, 0), expected_color)
|
|
|
|
actual_color = im.getpixel((0, 0))
|
|
|
|
assert actual_color == expected_color, (
|
|
|
|
f"put/getpixel roundtrip failed for mode {mode}, "
|
|
|
|
f"expected {expected_color} got {actual_color}"
|
|
|
|
)
|
2016-07-03 04:33:14 +03:00
|
|
|
|
2024-04-25 16:51:33 +03:00
|
|
|
# Check putpixel negative index
|
2023-01-16 16:46:11 +03:00
|
|
|
im.putpixel((-1, -1), expected_color)
|
|
|
|
actual_color = im.getpixel((-1, -1))
|
|
|
|
assert actual_color == expected_color, (
|
2023-01-16 04:42:55 +03:00
|
|
|
f"put/getpixel roundtrip negative index failed for mode {mode}, "
|
2023-01-16 16:46:11 +03:00
|
|
|
f"expected {expected_color} got {actual_color}"
|
2023-01-16 04:42:55 +03:00
|
|
|
)
|
2018-10-15 13:51:24 +03:00
|
|
|
|
2024-04-25 16:51:33 +03:00
|
|
|
# Check 0x0 image with None initial color
|
2016-12-27 15:53:23 +03:00
|
|
|
im = Image.new(mode, (0, 0), None)
|
2022-03-03 14:10:19 +03:00
|
|
|
assert im.load() is not None
|
2024-06-29 08:02:50 +03:00
|
|
|
with pytest.raises(IndexError):
|
2023-01-16 16:46:11 +03:00
|
|
|
im.putpixel((0, 0), expected_color)
|
2024-06-29 08:02:50 +03:00
|
|
|
with pytest.raises(IndexError):
|
2016-12-27 15:53:23 +03:00
|
|
|
im.getpixel((0, 0))
|
2024-04-25 16:51:33 +03:00
|
|
|
# Check negative index
|
2024-06-29 08:02:50 +03:00
|
|
|
with pytest.raises(IndexError):
|
2023-01-16 16:46:11 +03:00
|
|
|
im.putpixel((-1, -1), expected_color)
|
2024-06-29 08:02:50 +03:00
|
|
|
with pytest.raises(IndexError):
|
2018-10-15 13:51:24 +03:00
|
|
|
im.getpixel((-1, -1))
|
2017-03-01 12:20:18 +03:00
|
|
|
|
2024-04-25 16:51:33 +03:00
|
|
|
# Check initial color
|
2023-01-16 16:46:11 +03:00
|
|
|
im = Image.new(mode, (1, 1), expected_color)
|
|
|
|
actual_color = im.getpixel((0, 0))
|
|
|
|
assert actual_color == expected_color, (
|
|
|
|
f"initial color failed for mode {mode}, "
|
|
|
|
f"expected {expected_color} got {actual_color}"
|
|
|
|
)
|
2023-01-16 04:42:55 +03:00
|
|
|
|
2024-04-25 16:51:33 +03:00
|
|
|
# Check initial color negative index
|
2023-01-16 16:46:11 +03:00
|
|
|
actual_color = im.getpixel((-1, -1))
|
|
|
|
assert actual_color == expected_color, (
|
2023-01-16 04:42:55 +03:00
|
|
|
f"initial color failed with negative index for mode {mode}, "
|
2023-01-16 16:46:11 +03:00
|
|
|
f"expected {expected_color} got {actual_color}"
|
2023-01-16 04:42:55 +03:00
|
|
|
)
|
2016-07-03 04:33:14 +03:00
|
|
|
|
2024-04-25 16:51:33 +03:00
|
|
|
# Check 0x0 image with initial color
|
2023-01-16 16:46:11 +03:00
|
|
|
im = Image.new(mode, (0, 0), expected_color)
|
2024-06-29 08:02:50 +03:00
|
|
|
with pytest.raises(IndexError):
|
2016-12-27 15:53:23 +03:00
|
|
|
im.getpixel((0, 0))
|
2024-04-25 16:51:33 +03:00
|
|
|
# Check negative index
|
2024-06-29 08:02:50 +03:00
|
|
|
with pytest.raises(IndexError):
|
2018-10-15 13:51:24 +03:00
|
|
|
im.getpixel((-1, -1))
|
2016-12-27 15:53:23 +03:00
|
|
|
|
2024-05-12 14:20:46 +03:00
|
|
|
@pytest.mark.parametrize("mode", Image.MODES)
|
2024-02-12 01:28:53 +03:00
|
|
|
def test_basic(self, mode: str) -> None:
|
2024-05-12 14:20:46 +03:00
|
|
|
self.check(mode)
|
|
|
|
|
|
|
|
@pytest.mark.parametrize("mode", ("BGR;15", "BGR;16", "BGR;24"))
|
|
|
|
def test_deprecated(self, mode: str) -> None:
|
|
|
|
with pytest.warns(DeprecationWarning):
|
2024-04-15 12:28:52 +03:00
|
|
|
self.check(mode)
|
2016-07-03 04:33:14 +03:00
|
|
|
|
2024-01-31 12:12:58 +03:00
|
|
|
def test_list(self) -> None:
|
2023-08-28 13:12:23 +03:00
|
|
|
im = hopper()
|
|
|
|
assert im.getpixel([0, 0]) == (20, 20, 70)
|
|
|
|
|
2022-08-23 14:41:32 +03:00
|
|
|
@pytest.mark.parametrize("mode", ("I;16", "I;16B"))
|
2024-02-05 20:18:49 +03:00
|
|
|
@pytest.mark.parametrize("expected_color", (2**15 - 1, 2**15, 2**15 + 1, 2**16 - 1))
|
2024-02-12 01:28:53 +03:00
|
|
|
def test_signedness(self, mode: str, expected_color: int) -> None:
|
2024-04-25 16:51:33 +03:00
|
|
|
# See https://github.com/python-pillow/Pillow/issues/452
|
2016-07-03 04:33:14 +03:00
|
|
|
# pixelaccess is using signed int* instead of uint*
|
2023-01-16 16:47:24 +03:00
|
|
|
self.check(mode, expected_color)
|
2014-01-05 22:41:25 +04:00
|
|
|
|
2022-08-14 07:34:42 +03:00
|
|
|
@pytest.mark.parametrize("mode", ("P", "PA"))
|
2022-08-23 14:41:32 +03:00
|
|
|
@pytest.mark.parametrize("color", ((255, 0, 0), (255, 0, 0, 255)))
|
2024-02-12 01:28:53 +03:00
|
|
|
def test_p_putpixel_rgb_rgba(self, mode: str, color: tuple[int, ...]) -> None:
|
2022-08-31 13:56:38 +03:00
|
|
|
im = Image.new(mode, (1, 1))
|
2022-08-23 14:41:32 +03:00
|
|
|
im.putpixel((0, 0), color)
|
2022-08-14 07:34:42 +03:00
|
|
|
|
2022-08-31 13:56:38 +03:00
|
|
|
alpha = color[3] if len(color) == 4 and mode == "PA" else 255
|
|
|
|
assert im.convert("RGBA").getpixel((0, 0)) == (255, 0, 0, alpha)
|
2018-12-31 03:35:15 +03:00
|
|
|
|
2014-06-10 13:10:47 +04:00
|
|
|
|
2024-06-29 08:02:50 +03:00
|
|
|
class TestImagePutPixelError:
|
2023-03-19 16:30:10 +03:00
|
|
|
IMAGE_MODES1 = ["LA", "RGB", "RGBA", "BGR;15"]
|
|
|
|
IMAGE_MODES2 = ["L", "I", "I;16"]
|
2020-09-20 07:23:05 +03:00
|
|
|
INVALID_TYPES = ["foo", 1.0, None]
|
2020-08-21 00:16:19 +03:00
|
|
|
|
2020-09-22 06:06:52 +03:00
|
|
|
@pytest.mark.parametrize("mode", IMAGE_MODES1)
|
2024-02-12 01:28:53 +03:00
|
|
|
def test_putpixel_type_error1(self, mode: str) -> None:
|
2020-08-21 00:16:19 +03:00
|
|
|
im = hopper(mode)
|
2020-09-20 07:23:05 +03:00
|
|
|
for v in self.INVALID_TYPES:
|
2020-08-21 00:16:19 +03:00
|
|
|
with pytest.raises(TypeError, match="color must be int or tuple"):
|
2024-07-05 20:56:24 +03:00
|
|
|
im.putpixel((0, 0), v) # type: ignore[arg-type]
|
2020-08-21 00:16:19 +03:00
|
|
|
|
2021-05-19 13:19:57 +03:00
|
|
|
@pytest.mark.parametrize(
|
2024-08-07 12:17:49 +03:00
|
|
|
"mode, band_numbers, match",
|
2021-05-19 13:19:57 +03:00
|
|
|
(
|
|
|
|
("L", (0, 2), "color must be int or single-element tuple"),
|
|
|
|
("LA", (0, 3), "color must be int, or tuple of one or two elements"),
|
2023-03-19 16:30:10 +03:00
|
|
|
(
|
|
|
|
"BGR;15",
|
|
|
|
(0, 2),
|
|
|
|
"color must be int, or tuple of one or three elements",
|
|
|
|
),
|
2021-05-19 13:19:57 +03:00
|
|
|
(
|
|
|
|
"RGB",
|
|
|
|
(0, 2, 5),
|
|
|
|
"color must be int, or tuple of one, three or four elements",
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)
|
2024-02-12 01:28:53 +03:00
|
|
|
def test_putpixel_invalid_number_of_bands(
|
|
|
|
self, mode: str, band_numbers: tuple[int, ...], match: str
|
|
|
|
) -> None:
|
2021-05-19 13:19:57 +03:00
|
|
|
im = hopper(mode)
|
|
|
|
for band_number in band_numbers:
|
|
|
|
with pytest.raises(TypeError, match=match):
|
|
|
|
im.putpixel((0, 0), (0,) * band_number)
|
|
|
|
|
2020-09-22 06:06:52 +03:00
|
|
|
@pytest.mark.parametrize("mode", IMAGE_MODES2)
|
2024-02-12 01:28:53 +03:00
|
|
|
def test_putpixel_type_error2(self, mode: str) -> None:
|
2020-09-22 06:06:52 +03:00
|
|
|
im = hopper(mode)
|
|
|
|
for v in self.INVALID_TYPES:
|
|
|
|
with pytest.raises(
|
|
|
|
TypeError, match="color must be int or single-element tuple"
|
|
|
|
):
|
2024-07-05 20:56:24 +03:00
|
|
|
im.putpixel((0, 0), v) # type: ignore[arg-type]
|
2020-09-22 06:06:52 +03:00
|
|
|
|
|
|
|
@pytest.mark.parametrize("mode", IMAGE_MODES1 + IMAGE_MODES2)
|
2024-02-12 01:28:53 +03:00
|
|
|
def test_putpixel_overflow_error(self, mode: str) -> None:
|
2020-08-21 00:16:19 +03:00
|
|
|
im = hopper(mode)
|
|
|
|
with pytest.raises(OverflowError):
|
2022-03-04 08:42:24 +03:00
|
|
|
im.putpixel((0, 0), 2**80)
|
2020-08-21 00:16:19 +03:00
|
|
|
|
2020-08-20 00:43:43 +03:00
|
|
|
|
2020-03-02 17:02:19 +03:00
|
|
|
class TestEmbeddable:
|
2022-10-30 05:56:05 +03:00
|
|
|
@pytest.mark.xfail(reason="failing test")
|
|
|
|
@pytest.mark.skipif(not is_win32(), reason="requires Windows")
|
2024-01-31 12:12:58 +03:00
|
|
|
def test_embeddable(self) -> None:
|
2022-03-19 06:46:25 +03:00
|
|
|
import ctypes
|
2022-10-30 06:17:54 +03:00
|
|
|
|
2024-02-12 01:28:53 +03:00
|
|
|
from setuptools.command import build_ext
|
2022-03-19 06:46:25 +03:00
|
|
|
|
2022-10-13 05:22:49 +03:00
|
|
|
with open("embed_pil.c", "w", encoding="utf-8") as fh:
|
2024-05-08 10:57:36 +03:00
|
|
|
home = sys.prefix.replace("\\", "\\\\")
|
2019-06-13 18:54:24 +03:00
|
|
|
fh.write(
|
2024-05-08 10:57:36 +03:00
|
|
|
f"""
|
2016-12-20 18:40:06 +03:00
|
|
|
#include "Python.h"
|
|
|
|
|
|
|
|
int main(int argc, char* argv[])
|
2024-05-08 10:57:36 +03:00
|
|
|
{{
|
|
|
|
char *home = "{home}";
|
2017-01-12 01:12:31 +03:00
|
|
|
wchar_t *whome = Py_DecodeLocale(home, NULL);
|
|
|
|
Py_SetPythonHome(whome);
|
|
|
|
|
|
|
|
Py_InitializeEx(0);
|
|
|
|
Py_DECREF(PyImport_ImportModule("PIL.Image"));
|
2016-12-20 18:40:06 +03:00
|
|
|
Py_Finalize();
|
|
|
|
|
2017-01-12 01:12:31 +03:00
|
|
|
Py_InitializeEx(0);
|
|
|
|
Py_DECREF(PyImport_ImportModule("PIL.Image"));
|
2016-12-20 18:40:06 +03:00
|
|
|
Py_Finalize();
|
|
|
|
|
2017-01-12 01:12:31 +03:00
|
|
|
PyMem_RawFree(whome);
|
|
|
|
|
2016-12-20 18:40:06 +03:00
|
|
|
return 0;
|
2024-05-08 10:57:36 +03:00
|
|
|
}}
|
2019-06-13 18:54:24 +03:00
|
|
|
"""
|
|
|
|
)
|
2016-12-20 18:40:06 +03:00
|
|
|
|
2024-02-12 01:28:53 +03:00
|
|
|
compiler = getattr(build_ext, "new_compiler")()
|
2020-09-01 20:16:46 +03:00
|
|
|
compiler.add_include_dir(sysconfig.get_config_var("INCLUDEPY"))
|
2017-12-12 23:55:11 +03:00
|
|
|
|
2020-09-01 20:16:46 +03:00
|
|
|
libdir = sysconfig.get_config_var("LIBDIR") or sysconfig.get_config_var(
|
|
|
|
"INCLUDEPY"
|
|
|
|
).replace("include", "libs")
|
2017-01-12 02:45:19 +03:00
|
|
|
compiler.add_library_dir(libdir)
|
2019-06-13 18:54:24 +03:00
|
|
|
objects = compiler.compile(["embed_pil.c"])
|
|
|
|
compiler.link_executable(objects, "embed_pil")
|
2017-01-12 02:45:19 +03:00
|
|
|
|
|
|
|
env = os.environ.copy()
|
2019-06-13 18:54:24 +03:00
|
|
|
env["PATH"] = sys.prefix + ";" + env["PATH"]
|
2017-12-12 23:55:11 +03:00
|
|
|
|
2024-04-25 16:51:33 +03:00
|
|
|
# Do not display the Windows Error Reporting dialog
|
2024-02-12 01:28:53 +03:00
|
|
|
getattr(ctypes, "windll").kernel32.SetErrorMode(0x0002)
|
2017-12-12 23:55:11 +03:00
|
|
|
|
2019-06-13 18:54:24 +03:00
|
|
|
process = subprocess.Popen(["embed_pil.exe"], env=env)
|
2017-01-12 01:12:31 +03:00
|
|
|
process.communicate()
|
2020-02-22 16:06:21 +03:00
|
|
|
assert process.returncode == 0
|