Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .ci/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@

set -e

python3 -m coverage erase
make clean
make install-coverage
7 changes: 0 additions & 7 deletions .ci/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,7 @@ sudo apt-get -qq install libfreetype6-dev liblcms2-dev libtiff-dev python3-tk\

python3 -m pip install --upgrade pip
python3 -m pip install --upgrade wheel
python3 -m pip install coverage
python3 -m pip install defusedxml
python3 -m pip install ipython
python3 -m pip install olefile
python3 -m pip install -U pytest
python3 -m pip install -U pytest-cov
python3 -m pip install -U pytest-timeout
python3 -m pip install pyroma
# optional test dependencies, only install if there's a binary package.
python3 -m pip install --only-binary=:all: numpy || true
python3 -m pip install --only-binary=:all: pyarrow || true
Expand Down
2 changes: 1 addition & 1 deletion .ci/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ set -e

python3 -c "from PIL import Image"

python3 -bb -m pytest -vv -x -W always --cov PIL --cov Tests --cov-report term --cov-report xml Tests $REVERSE
python3 -bb -m pytest -vv -x -W always --cov PIL --cov Tests --cov-report term --cov-report xml Tests
2 changes: 1 addition & 1 deletion .github/workflows/test-mingw.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ jobs:
pushd depends && ./install_extra_test_images.sh && popd

- name: Build Pillow
run: CFLAGS="-coverage" python3 -m pip install .
run: CFLAGS="-coverage" python3 -m pip install .[tests]

- name: Test Pillow
run: |
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/test-valgrind-memory.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,10 @@ jobs:
run: |
# The Pillow user in the docker container is UID 1001
sudo chown -R 1001 $GITHUB_WORKSPACE
docker run --name pillow_container -e "PILLOW_VALGRIND_TEST=true" -v $GITHUB_WORKSPACE:/Pillow pythonpillow/${{ matrix.docker }}:${{ matrix.dockerTag }} /Pillow/depends/docker-test-valgrind-memory.sh
docker run --name pillow_container \
-e "PILLOW_VALGRIND_TEST=true" \
-e "PYTEST_ADDOPTS=-n0" \
-v $GITHUB_WORKSPACE:/Pillow \
pythonpillow/${{ matrix.docker }}:${{ matrix.dockerTag }} \
bash -c "python3 -m pip install pytest-xdist && /Pillow/depends/docker-test-valgrind-memory.sh"
sudo chown -R runner $GITHUB_WORKSPACE
6 changes: 5 additions & 1 deletion .github/workflows/test-valgrind.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,9 @@ jobs:
run: |
# The Pillow user in the docker container is UID 1001
sudo chown -R 1001 $GITHUB_WORKSPACE
docker run --name pillow_container -e "PILLOW_VALGRIND_TEST=true" -v $GITHUB_WORKSPACE:/Pillow pythonpillow/${{ matrix.docker }}:${{ matrix.dockerTag }}
docker run --name pillow_container \
-e "PILLOW_VALGRIND_TEST=true" \
-e "PYTEST_ADDOPTS=-n0" \
-v $GITHUB_WORKSPACE:/Pillow \
pythonpillow/${{ matrix.docker }}:${{ matrix.dockerTag }}
sudo chown -R runner $GITHUB_WORKSPACE
6 changes: 1 addition & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
"3.10",
]
include:
- { python-version: "3.12", PYTHONOPTIMIZE: 1, REVERSE: "--reverse" }
- { python-version: "3.12", PYTHONOPTIMIZE: 1 }
- { python-version: "3.11", PYTHONOPTIMIZE: 2 }
# Free-threaded
- { python-version: "3.15t", disable-gil: true }
Expand Down Expand Up @@ -123,9 +123,6 @@ jobs:

- name: Test
run: |
if [ $REVERSE ]; then
python3 -m pip install pytest-reverse
fi
if [ "${{ matrix.os }}" = "ubuntu-latest" ]; then
xvfb-run -s '-screen 0 1024x768x24' sway&
export WAYLAND_DISPLAY=wayland-1
Expand All @@ -135,7 +132,6 @@ jobs:
fi
env:
PYTHONOPTIMIZE: ${{ matrix.PYTHONOPTIMIZE }}
REVERSE: ${{ matrix.REVERSE }}

- name: Prepare to upload errors
if: failure()
Expand Down
8 changes: 1 addition & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ install:

.PHONY: install-coverage
install-coverage:
CFLAGS="-coverage -Werror=implicit-function-declaration" python3 -m pip -v install .
CFLAGS="-coverage -Werror=implicit-function-declaration" python3 -m pip -v install .[tests]
python3 selftest.py

.PHONY: debug
Expand Down Expand Up @@ -97,12 +97,6 @@ test:
python3 -c "import pytest" > /dev/null 2>&1 || python3 -m pip install pytest
python3 -m pytest -qq

.PHONY: test-p
test-p:
python3 -c "import xdist" > /dev/null 2>&1 || python3 -m pip install pytest-xdist
python3 -m pytest -qq -n auto


.PHONY: valgrind
valgrind:
python3 -c "import pytest_valgrind" > /dev/null 2>&1 || python3 -m pip install pytest-valgrind
Expand Down
1 change: 1 addition & 0 deletions Tests/test_file_avif.py
Original file line number Diff line number Diff line change
Expand Up @@ -772,6 +772,7 @@ def test_seek_errors(self) -> None:
MAX_THREADS = os.cpu_count() or 1


@pytest.mark.xdist_group(name="leak-group")
@skip_unless_feature("avif")
class TestAvifLeaks(PillowLeakTestCase):
mem_limit = MAX_THREADS * 3 * 1024
Expand Down
1 change: 1 addition & 0 deletions Tests/test_imagegrab.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from .helper import assert_image_equal_tofile, skip_unless_feature


@pytest.mark.xdist_group(name="imagegrab-group")
class TestImageGrab:
@pytest.mark.skipif(
os.environ.get("USERNAME") == "ContainerAdministrator",
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ optional-dependencies.tests = [
"pyroma>=5",
"pytest",
"pytest-cov",
"pytest-sugar",
"pytest-timeout",
"pytest-xdist",
"trove-classifiers>=2024.10.12",
Expand Down Expand Up @@ -208,7 +209,7 @@ lint.isort.required-imports = [
max_supported_python = "3.14"

[tool.pytest.ini_options]
addopts = "-ra --color=auto"
addopts = "-ra --color=auto --numprocesses=auto --dist=loadgroup"
testpaths = [
"Tests",
]
Expand Down
Loading