Skip to content

Test icon generation fallbacks when Pillow is unavailable #93

Open

Description

@owenthcarey

Problem

src/pythonnative/project/icons.py promises that icon and splash generation returns False when the optional Pillow dependency is unavailable, allowing the build to retain its template assets. dominant_background_color() similarly returns None.

The tests in tests/project/test_icons.py cover the successful image-generation paths, but their module-level skipif skips the entire file when Pillow is missing. There are no tests protecting the fallback behavior or proving that it leaves existing assets alone.

Requested change

Add a separate tests/project/test_icons_optional.py that doesn't import Pillow or inherit the existing module-wide skip. Monkeypatch icons.pillow_available to return False so the tests run regardless of whether Pillow is installed on the contributor's machine.

Acceptance criteria

  • generate_ios_icons(), generate_android_icons(), generate_ios_splash(), and generate_android_splash_icon() return False.
  • dominant_background_color() returns None.
  • Missing source files don't get opened in these fallback paths; _open_rgba can be patched to fail if called.
  • An absent output directory remains absent, and existing sentinel files remain byte-for-byte unchanged, including an Android adaptive-icon XML file.
  • The new tests run without creating any images or requiring Android SDK/Xcode.

Keep this a test-only change. Use the existing public return-value contract and filesystem outcomes as assertions.

Verification

uv run pytest tests/project/test_icons_optional.py tests/project/test_icons.py -q
./scripts/check.sh

Suggested commit message

Following CONTRIBUTING.md:

test(project): cover asset generation without Pillow

Before starting

Please follow the issue-claiming process: check for an assignee or linked pull request, comment to claim the issue, and wait for a maintainer to assign it before opening a pull request. Contributor setup is in CONTRIBUTING.md.

Activity

  1. glenlouis8 commented on Oct 9, 2026

    @glenlouis8
    Contributor

    Hi, I'd like to take this one as well. I'll add tests for the icon generation fallback when Pillow isn't installed and open a PR within a few days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

good first issue

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions