Skip to content

Commit

Permalink
Merge branch 'main' into test_cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Yay295 authored Feb 13, 2023
2 parents b9051b5 + 98b2a56 commit 0b4bfce
Show file tree
Hide file tree
Showing 133 changed files with 211 additions and 451 deletions.
4 changes: 3 additions & 1 deletion .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@ environment:
install:
- '%PYTHON%\%EXECUTABLE% --version'
- curl -fsSL -o pillow-depends.zip https://github.com/python-pillow/pillow-depends/archive/main.zip
- curl -fsSL -o pillow-test-images.zip https://github.com/python-pillow/test-images/archive/main.zip
- 7z x pillow-depends.zip -oc:\
- 7z x pillow-test-images.zip -oc:\
- mv c:\pillow-depends-main c:\pillow-depends
- xcopy /S /Y c:\pillow-depends\test_images\* c:\pillow\tests\images
- xcopy /S /Y c:\test-images-main\* c:\pillow\tests\images
- 7z x ..\pillow-depends\nasm-2.15.05-win64.zip -oc:\
- ..\pillow-depends\gs1000w32.exe /S
- path c:\nasm-2.15.05;C:\Program Files (x86)\gs\gs10.0.0\bin;%PATH%
Expand Down
3 changes: 2 additions & 1 deletion .ci/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ python3 -m pip install -U pytest-timeout
python3 -m pip install pyroma

if [[ $(uname) != CYGWIN* ]]; then
python3 -m pip install numpy
# TODO Remove condition when NumPy supports 3.12
if ! [ "$GHA_PYTHON_VERSION" == "3.12-dev" ]; then python3 -m pip install numpy ; fi

# PyQt6 doesn't support PyPy3
if [[ $GHA_PYTHON_VERSION == 3.* ]]; then
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/macos-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ python3 -m pip install -U pytest-cov
python3 -m pip install -U pytest-timeout
python3 -m pip install pyroma

python3 -m pip install numpy
# TODO Remove condition when NumPy supports 3.12
if ! [ "$GHA_PYTHON_VERSION" == "3.12-dev" ]; then python3 -m pip install numpy ; fi

# extra test images
pushd depends && ./install_extra_test_images.sh && popd
28 changes: 22 additions & 6 deletions .github/workflows/test-cygwin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,34 @@ jobs:
with:
platform: x86_64
packages: >
ImageMagick gcc-g++ ghostscript jpeg libfreetype-devel
libimagequant-devel libjpeg-devel liblapack-devel
liblcms2-devel libopenjp2-devel libraqm-devel
libtiff-devel libwebp-devel libxcb-devel libxcb-xinerama0
make netpbm perl
gcc-g++
ghostscript
ImageMagick
jpeg
libfreetype-devel
libimagequant-devel
libjpeg-devel
liblapack-devel
liblcms2-devel
libopenjp2-devel
libraqm-devel
libtiff-devel
libwebp-devel
libxcb-devel
libxcb-xinerama0
make
netpbm
perl
python3${{ matrix.python-minor-version }}-cffi
python3${{ matrix.python-minor-version }}-cython
python3${{ matrix.python-minor-version }}-devel
python3${{ matrix.python-minor-version }}-numpy
python3${{ matrix.python-minor-version }}-sip
python3${{ matrix.python-minor-version }}-tkinter
qt5-devel-tools subversion xorg-server-extra zlib-devel
qt5-devel-tools
wget
xorg-server-extra
zlib-devel
- name: Add Lapack to PATH
uses: egor-tensin/cleanup-path@v3
Expand Down
11 changes: 5 additions & 6 deletions .github/workflows/test-mingw.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,6 @@ jobs:
- name: Install dependencies
run: |
pacman -S --noconfirm \
${{ matrix.package }}-python3-cffi \
${{ matrix.package }}-python3-numpy \
${{ matrix.package }}-python3-olefile \
${{ matrix.package }}-python3-pip \
${{ matrix.package }}-python3-setuptools \
${{ matrix.package }}-freetype \
${{ matrix.package }}-gcc \
${{ matrix.package }}-ghostscript \
Expand All @@ -60,7 +55,11 @@ jobs:
${{ matrix.package }}-libtiff \
${{ matrix.package }}-libwebp \
${{ matrix.package }}-openjpeg2 \
subversion
${{ matrix.package }}-python3-cffi \
${{ matrix.package }}-python3-numpy \
${{ matrix.package }}-python3-olefile \
${{ matrix.package }}-python3-pip \
${{ matrix.package }}-python3-setuptools
if [ ${{ matrix.package }} == "mingw-w64-x86_64" ]; then
pacman -S --noconfirm \
Expand Down
11 changes: 9 additions & 2 deletions .github/workflows/test-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12-dev"]
architecture: ["x86", "x64"]
include:
# PyPy 7.3.4+ only ships 64-bit binaries for Windows
Expand All @@ -38,6 +38,12 @@ jobs:
repository: python-pillow/pillow-depends
path: winbuild\depends

- name: Checkout extra test images
uses: actions/checkout@v3
with:
repository: python-pillow/test-images
path: Tests\test-images

# sets env: pythonLocation
- name: Set up Python
uses: actions/setup-python@v4
Expand All @@ -62,7 +68,8 @@ jobs:
winbuild\depends\gs1000w32.exe /S
echo "C:\Program Files (x86)\gs\gs10.0.0\bin" >> $env:GITHUB_PATH
xcopy /S /Y winbuild\depends\test_images\* Tests\images\
# Install extra test images
xcopy /S /Y Tests\test-images\* Tests\images
# make cache key depend on VS version
& "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" `
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ jobs:
python-version: [
"pypy3.9",
"pypy3.8",
"3.12-dev",
"3.11",
"3.10",
"3.9",
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ docs/_build/
# JetBrains
.idea

# Extra test images installed from pillow-depends/test_images
# Extra test images installed from python-pillow/test-images
Tests/images/README.md
Tests/images/crash_1.tif
Tests/images/crash_2.tif
Expand Down
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/psf/black
rev: 22.12.0
rev: 23.1.0
hooks:
- id: black
args: [--target-version=py37]
Expand All @@ -9,7 +9,7 @@ repos:
types: []

- repo: https://github.com/PyCQA/isort
rev: 5.11.4
rev: 5.12.0
hooks:
- id: isort

Expand All @@ -26,7 +26,7 @@ repos:
- id: yesqa

- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.3.1
rev: v1.4.2
hooks:
- id: remove-tabs
exclude: (Makefile$|\.bat$|\.cmake$|\.eps$|\.fits$|\.opt$)
Expand All @@ -39,7 +39,7 @@ repos:
[flake8-2020, flake8-errmsg, flake8-implicit-str-concat]

- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.9.0
rev: v1.10.0
hooks:
- id: python-check-blanket-noqa
- id: rst-backticks
Expand All @@ -57,7 +57,7 @@ repos:
- id: sphinx-lint

- repo: https://github.com/tox-dev/tox-ini-fmt
rev: 0.5.2
rev: 0.6.1
hooks:
- id: tox-ini-fmt

Expand Down
18 changes: 18 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,24 @@ Changelog (Pillow)
9.5.0 (unreleased)
------------------

- Raise an error if EXIF data is too long when saving JPEG #6939
[radarhere]

- Handle more than one directory returned by pkg-config #6896
[sebastic, radarhere]

- Do not retry past formats when loading all formats for the first time #6902
[radarhere]

- Do not retry specified formats if they failed when opening #6893
[radarhere]

- Do not unintentionally load TIFF format at first #6892
[radarhere]

- Stop reading when EPS line becomes too long #6897
[radarhere]

- Allow writing IFDRational to BYTE tag #6890
[radarhere]

Expand Down
4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ By obtaining, using, and/or copying this software and/or its associated
documentation, you agree that you have read, understood, and will comply
with the following terms and conditions:

Permission to use, copy, modify, and distribute this software and its
associated documentation for any purpose and without fee is hereby granted,
Permission to use, copy, modify and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appears in all copies, and that
both that copyright notice and this permission notice appear in supporting
documentation, and that the name of Secret Labs AB or the author not be
Expand Down
1 change: 0 additions & 1 deletion Tests/check_fli_overflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


def test_fli_overflow():

# this should not crash with a malloc error or access violation
with Image.open(TEST_FILE) as im:
im.load()
1 change: 0 additions & 1 deletion Tests/check_png_dos.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ def test_ignore_dos_text():


def test_dos_text():

try:
im = Image.open(TEST_FILE)
im.load()
Expand Down
5 changes: 5 additions & 0 deletions Tests/test_deprecate.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
"Old thing is deprecated and will be removed in Pillow 10 "
r"\(2023-07-01\)\. Use new thing instead\.",
),
(
11,
"Old thing is deprecated and will be removed in Pillow 11 "
r"\(2024-10-15\)\. Use new thing instead\.",
),
(
None,
r"Old thing is deprecated and will be removed in a future version\. "
Expand Down
1 change: 0 additions & 1 deletion Tests/test_file_bmp.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ def test_rgba_bitfields():
# This test image has been manually hexedited
# to change the bitfield compression in the header from XBGR to RGBA
with Image.open("Tests/images/rgb32bf-rgba.bmp") as im:

# So before the comparing the image, swap the channels
b, g, r = im.split()[1:]
im = Image.merge("RGB", (r, g, b))
Expand Down
2 changes: 0 additions & 2 deletions Tests/test_file_bufrstub.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
def test_open():
# Act
with Image.open(TEST_FILE) as im:

# Assert
assert im.format == "BUFR"

Expand All @@ -31,7 +30,6 @@ def test_invalid_file():
def test_load():
# Arrange
with Image.open(TEST_FILE) as im:

# Act / Assert: stub cannot load without an implemented handler
with pytest.raises(OSError):
im.load()
Expand Down
2 changes: 0 additions & 2 deletions Tests/test_file_dcx.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ def test_sanity():

# Act
with Image.open(TEST_FILE) as im:

# Assert
assert im.size == (128, 128)
assert isinstance(im, DcxImagePlugin.DcxImageFile)
Expand Down Expand Up @@ -54,7 +53,6 @@ def test_invalid_file():
def test_tell():
# Arrange
with Image.open(TEST_FILE) as im:

# Act
frame = im.tell()

Expand Down
1 change: 0 additions & 1 deletion Tests/test_file_eps.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ def test_invalid_file():
@pytest.mark.skipif(not HAS_GHOSTSCRIPT, reason="Ghostscript not available")
def test_cmyk():
with Image.open("Tests/images/pil_sample_cmyk.eps") as cmyk_image:

assert cmyk_image.mode == "CMYK"
assert cmyk_image.size == (100, 100)
assert cmyk_image.format == "EPS"
Expand Down
1 change: 0 additions & 1 deletion Tests/test_file_fits.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
def test_open():
# Act
with Image.open(TEST_FILE) as im:

# Assert
assert im.format == "FITS"
assert im.size == (128, 128)
Expand Down
2 changes: 0 additions & 2 deletions Tests/test_file_fli.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ def test_context_manager():
def test_tell():
# Arrange
with Image.open(static_test_file) as im:

# Act
frame = im.tell()

Expand Down Expand Up @@ -110,7 +109,6 @@ def test_eoferror():

def test_seek_tell():
with Image.open(animated_test_file) as im:

layer_number = im.tell()
assert layer_number == 0

Expand Down
Loading

0 comments on commit 0b4bfce

Please sign in to comment.