Skip to content

Commit d49d2d1

Browse files
authored
Merge branch 'main' into type-hints-replace-io.BytesIO
2 parents 61d47c3 + 232bddd commit d49d2d1

59 files changed

Lines changed: 317 additions & 220 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/docs.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,26 @@ jobs:
3737
with:
3838
python-version: "3.x"
3939
cache: pip
40-
cache-dependency-path: ".ci/*.sh"
40+
cache-dependency-path: |
41+
".ci/*.sh"
42+
"pyproject.toml"
4143
4244
- name: Build system information
4345
run: python3 .github/workflows/system-info.py
4446

47+
- name: Cache libimagequant
48+
uses: actions/cache@v4
49+
id: cache-libimagequant
50+
with:
51+
path: ~/cache-libimagequant
52+
key: ${{ runner.os }}-libimagequant-${{ hashFiles('depends/install_imagequant.sh') }}
53+
4554
- name: Install Linux dependencies
4655
run: |
4756
.ci/install.sh
4857
env:
4958
GHA_PYTHON_VERSION: "3.x"
59+
GHA_LIBIMAGEQUANT_CACHE_HIT: ${{ steps.cache-libimagequant.outputs.cache-hit }}
5060

5161
- name: Build
5262
run: |

.github/workflows/test.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ concurrency:
2626
group: ${{ github.workflow }}-${{ github.ref }}
2727
cancel-in-progress: true
2828

29+
env:
30+
FORCE_COLOR: 1
31+
2932
jobs:
3033
build:
3134

@@ -65,17 +68,28 @@ jobs:
6568
python-version: ${{ matrix.python-version }}
6669
allow-prereleases: true
6770
cache: pip
68-
cache-dependency-path: ".ci/*.sh"
71+
cache-dependency-path: |
72+
".ci/*.sh"
73+
"pyproject.toml"
6974
7075
- name: Build system information
7176
run: python3 .github/workflows/system-info.py
7277

78+
- name: Cache libimagequant
79+
if: startsWith(matrix.os, 'ubuntu')
80+
uses: actions/cache@v4
81+
id: cache-libimagequant
82+
with:
83+
path: ~/cache-libimagequant
84+
key: ${{ runner.os }}-libimagequant-${{ hashFiles('depends/install_imagequant.sh') }}
85+
7386
- name: Install Linux dependencies
7487
if: startsWith(matrix.os, 'ubuntu')
7588
run: |
7689
.ci/install.sh
7790
env:
7891
GHA_PYTHON_VERSION: ${{ matrix.python-version }}
92+
GHA_LIBIMAGEQUANT_CACHE_HIT: ${{ steps.cache-libimagequant.outputs.cache-hit }}
7993

8094
- name: Install macOS dependencies
8195
if: startsWith(matrix.os, 'macOS')

CHANGES.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ Changelog (Pillow)
55
10.3.0 (unreleased)
66
-------------------
77

8+
- Do not support using test-image-results to upload images after test failures #7739
9+
[radarhere]
10+
11+
- Changed ImageMath.ops to be static #7721
12+
[radarhere]
13+
814
- Fix APNG info after seeking backwards more than twice #7701
915
[esoma, radarhere]
1016

Tests/check_j2k_overflow.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
from __future__ import annotations
22

3-
from pathlib import PosixPath
3+
from pathlib import Path
44

55
import pytest
66

77
from PIL import Image
88

99

10-
def test_j2k_overflow(tmp_path: PosixPath) -> None:
10+
def test_j2k_overflow(tmp_path: Path) -> None:
1111
im = Image.new("RGBA", (1024, 131584))
1212
target = str(tmp_path / "temp.jpc")
1313
with pytest.raises(OSError):

Tests/check_large_memory.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from __future__ import annotations
22

33
import sys
4-
from pathlib import PosixPath
4+
from pathlib import Path
55
from types import ModuleType
66

77
import pytest
@@ -31,18 +31,18 @@
3131
pytestmark = pytest.mark.skipif(sys.maxsize <= 2**32, reason="requires 64-bit system")
3232

3333

34-
def _write_png(tmp_path: PosixPath, xdim: int, ydim: int) -> None:
34+
def _write_png(tmp_path: Path, xdim: int, ydim: int) -> None:
3535
f = str(tmp_path / "temp.png")
3636
im = Image.new("L", (xdim, ydim), 0)
3737
im.save(f)
3838

3939

40-
def test_large(tmp_path: PosixPath) -> None:
40+
def test_large(tmp_path: Path) -> None:
4141
"""succeeded prepatch"""
4242
_write_png(tmp_path, XDIM, YDIM)
4343

4444

45-
def test_2gpx(tmp_path: PosixPath) -> None:
45+
def test_2gpx(tmp_path: Path) -> None:
4646
"""failed prepatch"""
4747
_write_png(tmp_path, XDIM, XDIM)
4848

Tests/check_large_memory_numpy.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from __future__ import annotations
22

33
import sys
4-
from pathlib import PosixPath
4+
from pathlib import Path
55

66
import pytest
77

@@ -25,19 +25,19 @@
2525
pytestmark = pytest.mark.skipif(sys.maxsize <= 2**32, reason="requires 64-bit system")
2626

2727

28-
def _write_png(tmp_path: PosixPath, xdim: int, ydim: int) -> None:
28+
def _write_png(tmp_path: Path, xdim: int, ydim: int) -> None:
2929
dtype = np.uint8
3030
a = np.zeros((xdim, ydim), dtype=dtype)
3131
f = str(tmp_path / "temp.png")
3232
im = Image.fromarray(a, "L")
3333
im.save(f)
3434

3535

36-
def test_large(tmp_path: PosixPath) -> None:
36+
def test_large(tmp_path: Path) -> None:
3737
"""succeeded prepatch"""
3838
_write_png(tmp_path, XDIM, YDIM)
3939

4040

41-
def test_2gpx(tmp_path: PosixPath) -> None:
41+
def test_2gpx(tmp_path: Path) -> None:
4242
"""failed prepatch"""
4343
_write_png(tmp_path, XDIM, XDIM)

Tests/helper.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,6 @@
2525
uploader = "show"
2626
elif "GITHUB_ACTIONS" in os.environ:
2727
uploader = "github_actions"
28-
else:
29-
try:
30-
import test_image_results
31-
32-
uploader = "aws"
33-
except ImportError:
34-
pass
3528

3629

3730
def upload(a: Image.Image, b: Image.Image) -> str | None:
@@ -46,8 +39,6 @@ def upload(a: Image.Image, b: Image.Image) -> str | None:
4639
a.save(os.path.join(tmpdir, "a.png"))
4740
b.save(os.path.join(tmpdir, "b.png"))
4841
return tmpdir
49-
elif uploader == "aws":
50-
return test_image_results.upload(a, b)
5142
return None
5243

5344

Tests/test_000_sanity.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from PIL import Image
44

55

6-
def test_sanity():
6+
def test_sanity() -> None:
77
# Make sure we have the binary extension
88
Image.core.new("L", (100, 100))
99

Tests/test_binary.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,20 @@
33
from PIL import _binary
44

55

6-
def test_standard():
6+
def test_standard() -> None:
77
assert _binary.i8(b"*") == 42
88
assert _binary.o8(42) == b"*"
99

1010

11-
def test_little_endian():
11+
def test_little_endian() -> None:
1212
assert _binary.i16le(b"\xff\xff\x00\x00") == 65535
1313
assert _binary.i32le(b"\xff\xff\x00\x00") == 65535
1414

1515
assert _binary.o16le(65535) == b"\xff\xff"
1616
assert _binary.o32le(65535) == b"\xff\xff\x00\x00"
1717

1818

19-
def test_big_endian():
19+
def test_big_endian() -> None:
2020
assert _binary.i16be(b"\x00\x00\xff\xff") == 0
2121
assert _binary.i32be(b"\x00\x00\xff\xff") == 65535
2222

Tests/test_file_cur.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
TEST_FILE = "Tests/images/deerstalker.cur"
88

99

10-
def test_sanity():
10+
def test_sanity() -> None:
1111
with Image.open(TEST_FILE) as im:
1212
assert im.size == (32, 32)
1313
assert isinstance(im, CurImagePlugin.CurImageFile)
@@ -17,7 +17,7 @@ def test_sanity():
1717
assert im.getpixel((16, 16)) == (84, 87, 86, 255)
1818

1919

20-
def test_invalid_file():
20+
def test_invalid_file() -> None:
2121
invalid_file = "Tests/images/flower.jpg"
2222

2323
with pytest.raises(SyntaxError):

0 commit comments

Comments
 (0)