Skip to content

Commit

Permalink
Merge branch 'main' into include-dir-type-confusion
Browse files Browse the repository at this point in the history
  • Loading branch information
radarhere committed Apr 10, 2023
2 parents fe4e52d + a41b9ce commit 6fce7d6
Show file tree
Hide file tree
Showing 46 changed files with 301 additions and 712 deletions.
2 changes: 1 addition & 1 deletion .ci/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ if [[ $(uname) != CYGWIN* ]]; then
# PyQt6 doesn't support PyPy3
if [[ $GHA_PYTHON_VERSION == 3.* ]]; then
sudo apt-get -qq install libegl1 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-shape0 libxkbcommon-x11-0
python3 -m pip install pyqt6
python3 -m pip install pyqt6 PyQt6-Qt6!=6.5.0
fi

# webp
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/test-cygwin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ jobs:
python3${{ matrix.python-minor-version }}-numpy
python3${{ matrix.python-minor-version }}-sip
python3${{ matrix.python-minor-version }}-tkinter
qt5-devel-tools
wget
xorg-server-extra
zlib-devel
Expand Down
3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ Changelog (Pillow)
10.0.0 (unreleased)
-------------------

- Remove deprecations for Pillow 10.0.0 #7059
[hugovk, radarhere]

- Drop support for soon-EOL Python 3.7 #7058
[hugovk, radarhere]

Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ debug:

.PHONY: release-test
release-test:
python3 Tests/check_release_notes.py
python3 -m pip install -e .[tests]
python3 selftest.py
python3 -m pytest Tests
Expand Down
6 changes: 6 additions & 0 deletions Tests/check_release_notes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import sys
from pathlib import Path

for rst in Path("docs/releasenotes").glob("[1-9]*.rst"):
if "TODO" in open(rst).read():
sys.exit(f"Error: remove TODO from {rst}")
18 changes: 0 additions & 18 deletions Tests/test_deprecated_imageqt.py

This file was deleted.

10 changes: 0 additions & 10 deletions Tests/test_file_apng.py
Original file line number Diff line number Diff line change
Expand Up @@ -655,13 +655,3 @@ def test_different_modes_in_later_frames(mode, tmp_path):
im.save(test_file, save_all=True, append_images=[Image.new(mode, (1, 1))])
with Image.open(test_file) as reloaded:
assert reloaded.mode == mode


def test_constants_deprecation():
for enum, prefix in {
PngImagePlugin.Disposal: "APNG_DISPOSE_",
PngImagePlugin.Blend: "APNG_BLEND_",
}.items():
for name in enum.__members__:
with pytest.warns(DeprecationWarning):
assert getattr(PngImagePlugin, prefix + name) == enum[name]
13 changes: 1 addition & 12 deletions Tests/test_file_blp.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pytest

from PIL import BlpImagePlugin, Image
from PIL import Image

from .helper import (
assert_image_equal,
Expand Down Expand Up @@ -72,14 +72,3 @@ def test_crashes(test_file):
with Image.open(f) as im:
with pytest.raises(OSError):
im.load()


def test_constants_deprecation():
for enum, prefix in {
BlpImagePlugin.Format: "BLP_FORMAT_",
BlpImagePlugin.Encoding: "BLP_ENCODING_",
BlpImagePlugin.AlphaEncoding: "BLP_ALPHA_ENCODING_",
}.items():
for name in enum.__members__:
with pytest.warns(DeprecationWarning):
assert getattr(BlpImagePlugin, prefix + name) == enum[name]
38 changes: 1 addition & 37 deletions Tests/test_file_fits.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import pytest

from PIL import FitsImagePlugin, FitsStubImagePlugin, Image
from PIL import FitsImagePlugin, Image

from .helper import assert_image_equal, hopper

Expand Down Expand Up @@ -48,39 +48,3 @@ def test_comment():
image_data = b"SIMPLE = T / comment string"
with pytest.raises(OSError):
FitsImagePlugin.FitsImageFile(BytesIO(image_data))


def test_stub_deprecated():
class Handler:
opened = False
loaded = False

def open(self, im):
self.opened = True

def load(self, im):
self.loaded = True
im.fp.close()
return Image.new("RGB", (1, 1))

handler = Handler()
with pytest.warns(DeprecationWarning):
FitsStubImagePlugin.register_handler(handler)

with Image.open(TEST_FILE) as im:
assert im.format == "FITS"
assert im.size == (128, 128)
assert im.mode == "L"

assert handler.opened
assert not handler.loaded

im.load()
assert handler.loaded

FitsStubImagePlugin._handler = None
Image.register_open(
FitsImagePlugin.FitsImageFile.format,
FitsImagePlugin.FitsImageFile,
FitsImagePlugin._accept,
)
9 changes: 0 additions & 9 deletions Tests/test_file_ftex.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,3 @@ def test_invalid_file():

with pytest.raises(SyntaxError):
FtexImagePlugin.FtexImageFile(invalid_file)


def test_constants_deprecation():
for enum, prefix in {
FtexImagePlugin.Format: "FORMAT_",
}.items():
for name in enum.__members__:
with pytest.warns(DeprecationWarning):
assert getattr(FtexImagePlugin, prefix + name) == enum[name]
6 changes: 0 additions & 6 deletions Tests/test_file_jpeg.py
Original file line number Diff line number Diff line change
Expand Up @@ -636,12 +636,6 @@ def test_save_low_quality_baseline_qtables(self):
assert max(im2.quantization[0]) <= 255
assert max(im2.quantization[1]) <= 255

def test_convert_dict_qtables_deprecation(self):
with pytest.warns(DeprecationWarning):
qtable = {0: [1, 2, 3, 4]}
qtable2 = JpegImagePlugin.convert_dict_qtables(qtable)
assert qtable == qtable2

@pytest.mark.skipif(not djpeg_available(), reason="djpeg not available")
def test_load_djpeg(self):
with Image.open(TEST_FILE) as img:
Expand Down
18 changes: 0 additions & 18 deletions Tests/test_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -929,25 +929,7 @@ def test_apply_transparency(self):
im.apply_transparency()
assert im.palette.colors[(27, 35, 6, 214)] == 24

def test_categories_deprecation(self):
with pytest.warns(DeprecationWarning):
assert hopper().category == 0

with pytest.warns(DeprecationWarning):
assert Image.NORMAL == 0
with pytest.warns(DeprecationWarning):
assert Image.SEQUENCE == 1
with pytest.warns(DeprecationWarning):
assert Image.CONTAINER == 2

def test_constants(self):
with pytest.warns(DeprecationWarning):
assert Image.LINEAR == Image.Resampling.BILINEAR
with pytest.warns(DeprecationWarning):
assert Image.CUBIC == Image.Resampling.BICUBIC
with pytest.warns(DeprecationWarning):
assert Image.ANTIALIAS == Image.Resampling.LANCZOS

for enum in (
Image.Transpose,
Image.Transform,
Expand Down
7 changes: 0 additions & 7 deletions Tests/test_image_point.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import pytest

from PIL import Image

from .helper import assert_image_equal, hopper


Expand Down Expand Up @@ -62,8 +60,3 @@ def test_f_mode():
im = hopper("F")
with pytest.raises(ValueError):
im.point(None)


def test_coerce_e_deprecation():
with pytest.warns(DeprecationWarning):
assert Image.coerce_e(2).data == 2
10 changes: 0 additions & 10 deletions Tests/test_imagecms.py
Original file line number Diff line number Diff line change
Expand Up @@ -617,16 +617,6 @@ def test_auxiliary_channels_isolated():
assert_image_equal(test_image.convert(dst_format[2]), reference_image)


def test_constants_deprecation():
for enum, prefix in {
ImageCms.Intent: "INTENT_",
ImageCms.Direction: "DIRECTION_",
}.items():
for name in enum.__members__:
with pytest.warns(DeprecationWarning):
assert getattr(ImageCms, prefix + name) == enum[name]


@pytest.mark.parametrize("mode", ("RGB", "RGBA", "RGBX"))
def test_rgb_lab(mode):
im = Image.new(mode, (1, 1))
Expand Down
17 changes: 0 additions & 17 deletions Tests/test_imagefont.py
Original file line number Diff line number Diff line change
Expand Up @@ -1083,14 +1083,6 @@ def test_woff2(layout_engine):
assert_image_similar_tofile(im, "Tests/images/test_woff2.png", 5)


def test_fill_deprecation(font):
with pytest.warns(DeprecationWarning):
font.getmask2("Hello world", fill=Image.core.fill)
with pytest.warns(DeprecationWarning):
with pytest.raises(TypeError):
font.getmask2("Hello world", fill=None)


def test_render_mono_size():
# issue 4177

Expand Down Expand Up @@ -1130,12 +1122,3 @@ def test_raqm_missing_warning(monkeypatch):
"Raqm layout was requested, but Raqm is not available. "
"Falling back to basic layout."
)


def test_constants_deprecation():
for enum, prefix in {
ImageFont.Layout: "LAYOUT_",
}.items():
for name in enum.__members__:
with pytest.warns(DeprecationWarning):
assert getattr(ImageFont, prefix + name) == enum[name]
4 changes: 0 additions & 4 deletions Tests/test_imagepalette.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ def test_sanity():
palette = ImagePalette.ImagePalette("RGB", list(range(256)) * 3)
assert len(palette.colors) == 256

with pytest.warns(DeprecationWarning):
with pytest.raises(ValueError):
ImagePalette.ImagePalette("RGB", list(range(256)) * 3, 10)


def test_reload():
with Image.open("Tests/images/hopper.gif") as im:
Expand Down
11 changes: 2 additions & 9 deletions Tests/test_imageqt.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,9 @@

import pytest

from .helper import assert_image_similar, hopper

with warnings.catch_warnings() as w:
warnings.simplefilter("ignore", category=DeprecationWarning)
from PIL import ImageQt
from PIL import ImageQt

from .helper import assert_image_similar, hopper

pytestmark = pytest.mark.skipif(
not ImageQt.qt_is_installed, reason="Qt bindings are not installed"
Expand All @@ -26,10 +23,6 @@ def test_rgb():
from PyQt6.QtGui import qRgb
elif ImageQt.qt_version == "side6":
from PySide6.QtGui import qRgb
elif ImageQt.qt_version == "5":
from PyQt5.QtGui import qRgb
elif ImageQt.qt_version == "side2":
from PySide2.QtGui import qRgb

assert qRgb(0, 0, 0) == qRgba(0, 0, 0, 255)

Expand Down
17 changes: 0 additions & 17 deletions Tests/test_imageshow.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,20 +89,3 @@ def test_ipythonviewer():

im = hopper()
assert test_viewer.show(im) == 1


@pytest.mark.skipif(
not on_ci() or is_win32(),
reason="Only run on CIs; hangs on Windows CIs",
)
@pytest.mark.parametrize("viewer", ImageShow._viewers)
def test_file_deprecated(tmp_path, viewer):
f = str(tmp_path / "temp.jpg")
hopper().save(f)
with pytest.warns(DeprecationWarning):
try:
viewer.show_file(file=f)
except NotImplementedError:
pass
with pytest.raises(TypeError):
viewer.show_file()
7 changes: 0 additions & 7 deletions Tests/test_imagetk.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,6 @@ def test_photoimage_blank(mode):
assert_image_equal(reloaded.convert(mode), im)


def test_box_deprecation():
im = hopper()
im_tk = ImageTk.PhotoImage(im)
with pytest.warns(DeprecationWarning):
im_tk.paste(im, (0, 0, 128, 128))


def test_bitmapimage():
im = hopper("1")

Expand Down
14 changes: 1 addition & 13 deletions Tests/test_qt_image_qapplication.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import warnings

import pytest

with warnings.catch_warnings():
warnings.simplefilter("ignore", category=DeprecationWarning)
from PIL import ImageQt
from PIL import ImageQt

from .helper import assert_image_equal_tofile, assert_image_similar, hopper

Expand All @@ -19,14 +15,6 @@
from PySide6.QtCore import QPoint
from PySide6.QtGui import QImage, QPainter, QRegion
from PySide6.QtWidgets import QApplication, QHBoxLayout, QLabel, QWidget
elif ImageQt.qt_version == "5":
from PyQt5.QtCore import QPoint
from PyQt5.QtGui import QImage, QPainter, QRegion
from PyQt5.QtWidgets import QApplication, QHBoxLayout, QLabel, QWidget
elif ImageQt.qt_version == "side2":
from PySide2.QtCore import QPoint
from PySide2.QtGui import QImage, QPainter, QRegion
from PySide2.QtWidgets import QApplication, QHBoxLayout, QLabel, QWidget

class Example(QWidget):
def __init__(self):
Expand Down
8 changes: 2 additions & 6 deletions Tests/test_qt_image_toqimage.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import warnings

import pytest

with warnings.catch_warnings():
warnings.simplefilter("ignore", category=DeprecationWarning)
from PIL import ImageQt
from PIL import ImageQt

from .helper import assert_image_equal, assert_image_equal_tofile, hopper

Expand Down Expand Up @@ -32,7 +28,7 @@ def test_sanity(mode, tmp_path):
assert_image_equal(rt, src)

if mode == "1":
# BW appears to not save correctly on QT5
# BW appears to not save correctly on Qt
# kicks out errors on console:
# libpng warning: Invalid color type/bit depth combination
# in IHDR
Expand Down
Loading

0 comments on commit 6fce7d6

Please sign in to comment.