Skip to content

Commit

Permalink
Fix test for i686
Browse files Browse the repository at this point in the history
  • Loading branch information
laggykiller committed Feb 26, 2024
1 parent 4750d89 commit c5f04a1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ jobs:
CIBW_ARCHS_WINDOWS: ${{ matrix.cibw_archs_windows }}
CIBW_ARCHS_MACOS: ${{ matrix.cibw_archs_macos }}
CIBW_ARCHS_LINUX: ${{ matrix.cibw_archs_linux }}
CIBW_TEST_REQUIRES: pytest Pillow
CIBW_TEST_REQUIRES: pytest
CIBW_BEFORE_TEST: pip install --prefer-binary Pillow
CIBW_TEST_COMMAND: pytest {package}/tests
# If enable stubgen (pyproject.toml), then requires mypy which depends on typed-ast
# typed-ast cannot run on pypy <3.8
Expand Down
24 changes: 17 additions & 7 deletions tests/test_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@
import ctypes
from pathlib import Path

from PIL import Image
import pytest
try:
from PIL import Image

PILLOW_LOADED = True
except ModuleNotFoundError:
PILLOW_LOADED = False

from rlottie_python import LottieAnimation
from rlottie_python.rlottiecommon import LOTLayerNode

Expand Down Expand Up @@ -109,12 +116,14 @@ def test_lottie_configure_model_cache_size():
with LottieAnimation.from_file(json_file) as anim:
anim.lottie_configure_model_cache_size(0)

@pytest.mark.skipif(PILLOW_LOADED is False, reason="Pillow not installed")
def test_render_pillow_frame():
with LottieAnimation.from_file(json_file) as anim:
im = anim.render_pillow_frame()

assert isinstance(im, Image.Image)


@pytest.mark.skipif(PILLOW_LOADED is False, reason="Pillow not installed")
def test_save_frame(tmpdir):
tmppath = Path(tmpdir, "0.png").as_posix()
with LottieAnimation.from_file(json_file) as anim:
Expand All @@ -123,13 +132,14 @@ def test_save_frame(tmpdir):
assert Path(tmppath).is_file()
Image.open(tmppath)

def _test_save_animation(out):
with LottieAnimation.from_file(json_file) as anim:
anim.save_frame(out)
@pytest.mark.skipif(PILLOW_LOADED is False, reason="Pillow not installed")
def test_save_animation(tmpdir):
def _test_save_animation(out):
with LottieAnimation.from_file(json_file) as anim:
anim.save_frame(out)

assert Path(out).is_file()
assert Path(out).is_file()

def test_save_animation(tmpdir):
for i in ("0.apng", "0.gif", "0.webp"):
tmppath = Path(tmpdir, i).as_posix()
_test_save_animation(tmppath)

0 comments on commit c5f04a1

Please sign in to comment.