Skip to content

Commit

Permalink
Merge pull request #4336 from hugovk/travis_arch
Browse files Browse the repository at this point in the history
Test on new Travis CPUs
  • Loading branch information
radarhere committed Jan 13, 2020
2 parents e32a732 + 428b063 commit 8606ae0
Show file tree
Hide file tree
Showing 14 changed files with 61 additions and 26 deletions.
File renamed without changes.
File renamed without changes.
4 changes: 4 additions & 0 deletions .travis/install.sh → .ci/install.sh
Expand Up @@ -16,8 +16,12 @@ pip install pyroma
pip install test-image-results
pip install numpy
if [[ $TRAVIS_PYTHON_VERSION == 3.* ]]; then
# arm64, ppc64le, s390x CPUs:
# "ERROR: Could not find a version that satisfies the requirement pyqt5"
if [[ $TRAVIS_CPU_ARCH == "amd64" ]]; then
sudo apt-get -qq install pyqt5-dev-tools
pip install pyqt5!=5.14.1
fi
fi

# docs only on Python 3.8
Expand Down
10 changes: 10 additions & 0 deletions .ci/test.sh
@@ -0,0 +1,10 @@
#!/bin/bash

set -e

python -m pytest -v -x --cov PIL --cov Tests --cov-report term Tests

# Docs
if [ "$TRAVIS_PYTHON_VERSION" == "3.8" ] && [ "$TRAVIS_CPU_ARCH" == "amd64" ]; then
make doccheck
fi
2 changes: 1 addition & 1 deletion .github/workflows/test-docker.yml
Expand Up @@ -50,7 +50,7 @@ jobs:
pip install wheel
sudo apt-get install -qq ruby-dev
PATH="$PATH:~/.local/bin"
.travis/after_success.sh
.ci/after_success.sh
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}

Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/test.yml
Expand Up @@ -36,7 +36,7 @@ jobs:
with:
path: ~/.cache/pip
key:
${{ matrix.os }}-${{ matrix.python-version }}-${{ hashFiles('**/.travis/*.sh') }}
${{ matrix.os }}-${{ matrix.python-version }}-${{ hashFiles('**/.ci/*.sh') }}
restore-keys: |
${{ matrix.os }}-${{ matrix.python-version }}-
Expand All @@ -46,7 +46,7 @@ jobs:
with:
path: ~/Library/Caches/pip
key:
${{ matrix.os }}-${{ matrix.python-version }}-${{ hashFiles('**/.travis/*.sh') }}
${{ matrix.os }}-${{ matrix.python-version }}-${{ hashFiles('**/.ci/*.sh') }}
restore-keys: |
${{ matrix.os }}-${{ matrix.python-version }}-
Expand All @@ -61,7 +61,7 @@ jobs:
- name: Install Linux dependencies
if: startsWith(matrix.os, 'ubuntu')
run: |
.travis/install.sh
.ci/install.sh
- name: Install macOS dependencies
if: startsWith(matrix.os, 'macOS')
Expand All @@ -70,11 +70,11 @@ jobs:
- name: Build
run: |
.travis/build.sh
.ci/build.sh
- name: Test
run: |
.travis/test.sh
.ci/test.sh
- name: Upload errors
uses: actions/upload-artifact@v1
Expand All @@ -86,7 +86,7 @@ jobs:
- name: After success
if: success()
run: |
.travis/after_success.sh
.ci/after_success.sh
env:
MATRIX_OS: ${{ matrix.os }}
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
Expand Down
19 changes: 13 additions & 6 deletions .travis.yml
Expand Up @@ -6,8 +6,7 @@ notifications:
irc: "chat.freenode.net#pil"

# Run fast lint first to get fast feedback.
# Run slow PyPy next, to give it a headstart and reduce waiting time.
# Run latest 3.x next, to get quick compatibility results.
# Run slower CPUs next, to give them a headstart and reduce waiting time.
# Then run the remainder.

matrix:
Expand All @@ -16,6 +15,14 @@ matrix:
- python: "3.6"
name: "Lint"
env: LINT="true"

- python: "3.6"
arch: arm64
- python: "3.7"
arch: ppc64le
- python: "3.5"
arch: s390x

- python: "pypy3"
name: "PyPy3 Xenial"
- python: "3.8"
Expand All @@ -38,20 +45,20 @@ install:
if [ "$LINT" == "true" ]; then
pip install tox
else
.travis/install.sh;
.ci/install.sh;
fi
script:
- |
if [ "$LINT" == "true" ]; then
tox -e lint
else
.travis/build.sh
.travis/test.sh
.ci/build.sh
.ci/test.sh
fi
after_success:
- |
if [ "$LINT" == "" ]; then
.travis/after_success.sh
.ci/after_success.sh
fi
8 changes: 0 additions & 8 deletions .travis/test.sh

This file was deleted.

2 changes: 1 addition & 1 deletion MANIFEST.in
Expand Up @@ -26,4 +26,4 @@ global-exclude .git*
global-exclude *.pyc
global-exclude *.so
prune .azure-pipelines
prune .travis
prune .ci
4 changes: 4 additions & 0 deletions Tests/helper.py
Expand Up @@ -348,6 +348,10 @@ def on_ci():
)


def is_big_endian():
return sys.byteorder == "big"


def is_win32():
return sys.platform.startswith("win32")

Expand Down
5 changes: 4 additions & 1 deletion Tests/test_file_jpeg2k.py
@@ -1,8 +1,9 @@
from io import BytesIO

import pytest
from PIL import Image, Jpeg2KImagePlugin

from .helper import PillowTestCase
from .helper import PillowTestCase, is_big_endian, on_ci

codecs = dir(Image.core)

Expand Down Expand Up @@ -165,11 +166,13 @@ def test_16bit_monochrome_has_correct_mode(self):
jp2.load()
self.assertEqual(jp2.mode, "I;16")

@pytest.mark.xfail(is_big_endian() and on_ci(), reason="Fails on big-endian")
def test_16bit_monochrome_jp2_like_tiff(self):
with Image.open("Tests/images/16bit.cropped.tif") as tiff_16bit:
with Image.open("Tests/images/16bit.cropped.jp2") as jp2:
self.assert_image_similar(jp2, tiff_16bit, 1e-3)

@pytest.mark.xfail(is_big_endian() and on_ci(), reason="Fails on big-endian")
def test_16bit_monochrome_j2k_like_tiff(self):
with Image.open("Tests/images/16bit.cropped.tif") as tiff_16bit:
with Image.open("Tests/images/16bit.cropped.j2k") as j2k:
Expand Down
11 changes: 10 additions & 1 deletion Tests/test_file_png.py
Expand Up @@ -2,9 +2,17 @@
import zlib
from io import BytesIO

import pytest
from PIL import Image, ImageFile, PngImagePlugin

from .helper import PillowLeakTestCase, PillowTestCase, hopper, is_win32
from .helper import (
PillowLeakTestCase,
PillowTestCase,
hopper,
is_big_endian,
is_win32,
on_ci,
)

try:
from PIL import _webp
Expand Down Expand Up @@ -72,6 +80,7 @@ def get_chunks(self, filename):
png.crc(cid, s)
return chunks

@pytest.mark.xfail(is_big_endian() and on_ci(), reason="Fails on big-endian")
def test_sanity(self):

# internal version number
Expand Down
5 changes: 4 additions & 1 deletion Tests/test_file_webp_animated.py
@@ -1,6 +1,7 @@
import pytest
from PIL import Image

from .helper import PillowTestCase
from .helper import PillowTestCase, is_big_endian, on_ci

try:
from PIL import _webp
Expand Down Expand Up @@ -36,6 +37,7 @@ def test_n_frames(self):
self.assertEqual(im.n_frames, 42)
self.assertTrue(im.is_animated)

@pytest.mark.xfail(is_big_endian() and on_ci(), reason="Fails on big-endian")
def test_write_animation_L(self):
"""
Convert an animated GIF to animated WebP, then compare the
Expand All @@ -61,6 +63,7 @@ def test_write_animation_L(self):
im.load()
self.assert_image_similar(im, orig.convert("RGBA"), 25.0)

@pytest.mark.xfail(is_big_endian() and on_ci(), reason="Fails on big-endian")
def test_write_animation_RGB(self):
"""
Write an animated WebP from RGB frames, and ensure the frames
Expand Down
5 changes: 4 additions & 1 deletion Tests/test_image_getextrema.py
@@ -1,9 +1,11 @@
import pytest
from PIL import Image

from .helper import PillowTestCase, hopper
from .helper import PillowTestCase, hopper, is_big_endian, on_ci


class TestImageGetExtrema(PillowTestCase):
@pytest.mark.xfail(is_big_endian() and on_ci(), reason="Fails on big-endian")
def test_extrema(self):
def extrema(mode):
return hopper(mode).getextrema()
Expand All @@ -18,6 +20,7 @@ def extrema(mode):
self.assertEqual(extrema("CMYK"), ((0, 255), (0, 255), (0, 255), (0, 0)))
self.assertEqual(extrema("I;16"), (1, 255))

@pytest.mark.xfail(is_big_endian() and on_ci(), reason="Fails on big-endian")
def test_true_16(self):
with Image.open("Tests/images/16_bit_noise.tif") as im:
self.assertEqual(im.mode, "I;16")
Expand Down

0 comments on commit 8606ae0

Please sign in to comment.