Skip to content

Commit 726de49

Browse files
authored
Merge branch 'main' into mode_enums
2 parents adfb66f + 98d6c3b commit 726de49

18 files changed

+137
-47
lines changed

.ci/requirements-cibw.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
cibuildwheel==3.0.1
1+
cibuildwheel==3.1.2

.github/workflows/test-cygwin.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252
persist-credentials: false
5353

5454
- name: Install Cygwin
55-
uses: cygwin/cygwin-install-action@v5
55+
uses: cygwin/cygwin-install-action@v6
5656
with:
5757
packages: >
5858
gcc-g++
@@ -89,10 +89,6 @@ jobs:
8989
with:
9090
dirs: 'C:\cygwin\bin;C:\cygwin\lib\lapack'
9191

92-
- name: Select Python version
93-
run: |
94-
ln -sf c:/cygwin/bin/python3.${{ matrix.python-minor-version }} c:/cygwin/bin/python3
95-
9692
- name: pip cache
9793
uses: actions/cache@v4
9894
with:

.github/workflows/test-windows.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
strategy:
3636
fail-fast: false
3737
matrix:
38-
python-version: ["pypy3.11", "pypy3.10", "3.10", "3.11", "3.12", ">=3.13.5", "3.14"]
38+
python-version: ["pypy3.11", "3.10", "3.11", "3.12", ">=3.13.5", "3.14"]
3939
architecture: ["x64"]
4040
include:
4141
# Test the oldest Python on 32-bit

.github/workflows/test.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ jobs:
4242
]
4343
python-version: [
4444
"pypy3.11",
45-
"pypy3.10",
4645
"3.14t",
4746
"3.14",
4847
"3.13t",

.github/workflows/wheels-dependencies.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ ARCHIVE_SDIR=pillow-depends-main
9595
# you change those versions, ensure the patch is also updated.
9696
FREETYPE_VERSION=2.13.3
9797
HARFBUZZ_VERSION=11.2.1
98-
LIBPNG_VERSION=1.6.49
98+
LIBPNG_VERSION=1.6.50
9999
JPEGTURBO_VERSION=3.1.1
100100
OPENJPEG_VERSION=2.5.3
101101
XZ_VERSION=5.8.1

MANIFEST.in

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ include LICENSE
1313
include Makefile
1414
include tox.ini
1515
graft Tests
16+
graft Tests/images
1617
graft checks
1718
graft patches
1819
graft src
@@ -28,8 +29,19 @@ exclude .editorconfig
2829
exclude .readthedocs.yml
2930
exclude codecov.yml
3031
exclude renovate.json
32+
exclude Tests/images/README.md
33+
exclude Tests/images/crash*.tif
34+
exclude Tests/images/string_dimension.tiff
3135
global-exclude .git*
3236
global-exclude *.pyc
3337
global-exclude *.so
3438
prune .ci
3539
prune wheels
40+
prune winbuild/build
41+
prune winbuild/depends
42+
prune Tests/errors
43+
prune Tests/images/jpeg2000
44+
prune Tests/images/msp
45+
prune Tests/images/picins
46+
prune Tests/images/sunraster
47+
prune Tests/test-images

Tests/test_features.py

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,7 @@ def test_check() -> None:
1818
for codec in features.codecs:
1919
assert features.check_codec(codec) == features.check(codec)
2020
for feature in features.features:
21-
if "webp" in feature:
22-
with pytest.warns(DeprecationWarning, match="webp"):
23-
assert features.check_feature(feature) == features.check(feature)
24-
else:
25-
assert features.check_feature(feature) == features.check(feature)
21+
assert features.check_feature(feature) == features.check(feature)
2622

2723

2824
def test_version() -> None:
@@ -48,11 +44,7 @@ def test(name: str, function: Callable[[str], str | None]) -> None:
4844
for codec in features.codecs:
4945
test(codec, features.version_codec)
5046
for feature in features.features:
51-
if "webp" in feature:
52-
with pytest.warns(DeprecationWarning, match="webp"):
53-
test(feature, features.version_feature)
54-
else:
55-
test(feature, features.version_feature)
47+
test(feature, features.version_feature)
5648

5749

5850
@skip_unless_feature("libjpeg_turbo")
@@ -112,6 +104,25 @@ def test_unsupported_module() -> None:
112104
features.version_module(module)
113105

114106

107+
def test_unsupported_feature() -> None:
108+
# Arrange
109+
feature = "unsupported_feature"
110+
# Act / Assert
111+
with pytest.raises(ValueError):
112+
features.check_feature(feature)
113+
with pytest.raises(ValueError):
114+
features.version_feature(feature)
115+
116+
117+
def test_unsupported_version() -> None:
118+
assert features.version("unsupported_version") is None
119+
120+
121+
def test_modulenotfound(monkeypatch: pytest.MonkeyPatch) -> None:
122+
monkeypatch.setattr(features, "features", {"test": ("PIL._test", "", "")})
123+
assert features.check_feature("test") is None
124+
125+
115126
@pytest.mark.parametrize("supported_formats", (True, False))
116127
def test_pilinfo(supported_formats: bool) -> None:
117128
buf = io.StringIO()

Tests/test_image_access.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,3 +315,10 @@ def test_embeddable(self) -> None:
315315
process = subprocess.Popen(["embed_pil.exe"], env=env)
316316
process.communicate()
317317
assert process.returncode == 0
318+
319+
def teardown_method(self) -> None:
320+
try:
321+
os.remove("embed_pil.c")
322+
except FileNotFoundError:
323+
# If the test was skipped or failed, the file won't exist
324+
pass

Tests/test_image_histogram.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,12 @@ def histogram(mode: str) -> tuple[int, int, int]:
1010

1111
assert histogram("1") == (256, 0, 10994)
1212
assert histogram("L") == (256, 0, 662)
13+
assert histogram("LA") == (512, 0, 16384)
14+
assert histogram("La") == (512, 0, 16384)
1315
assert histogram("I") == (256, 0, 662)
1416
assert histogram("F") == (256, 0, 662)
1517
assert histogram("P") == (256, 0, 1551)
18+
assert histogram("PA") == (512, 0, 16384)
1619
assert histogram("RGB") == (768, 4, 675)
1720
assert histogram("RGBA") == (1024, 0, 16384)
1821
assert histogram("CMYK") == (1024, 0, 16384)

Tests/test_imagecms.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -690,3 +690,17 @@ def test_cmyk_lab() -> None:
690690
im = Image.new("CMYK", (1, 1))
691691
converted_im = im.convert("LAB")
692692
assert converted_im.getpixel((0, 0)) == (255, 128, 128)
693+
694+
695+
def test_deprecation() -> None:
696+
profile = ImageCmsProfile(ImageCms.createProfile("sRGB"))
697+
with pytest.warns(
698+
DeprecationWarning, match="ImageCms.ImageCmsProfile.product_name"
699+
):
700+
profile.product_name
701+
with pytest.warns(
702+
DeprecationWarning, match="ImageCms.ImageCmsProfile.product_info"
703+
):
704+
profile.product_info
705+
with pytest.raises(AttributeError):
706+
profile.this_attribute_does_not_exist

0 commit comments

Comments
 (0)