Add cross-platform CI test matrix + PyPI classifiers (#25)

* Add cross-platform CI test matrix, PyPI classifiers

CI: new test.yml runs lint (ubuntu) + a test matrix (ubuntu/macos/windows
x py3.10/3.12, core+dev, GPU tests skip) on push to main and PRs, closing the
gap where only the release publish.yml ran (ubuntu, no tests). Add PyPI
classifiers (OS/Python/topic). README Tests badge, CLAUDE.md CI note.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* Make availability tests reflect installed deps, not assume gpu extra

The new core+dev CI matrix has no diffusers, so the invisible-engine
availability tests (asserting is_available() is True unconditionally) and the
two mocked invisible CLI tests (whose command gates on is_available before the
mock) failed. Assert availability == actual importability of torch+diffusers,
and patch the CLI availability gate so the mocked-engine tests run regardless of
the gpu extra.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Victor Kuznetsov
2026-05-29 11:04:12 -07:00
committed by GitHub
co-authored by Claude Opus 4.8
parent 96b3653b9e
commit a46268f6eb
7 changed files with 80 additions and 6 deletions
+2
View File
@@ -249,6 +249,7 @@ class TestInvisibleCommand:
mock_cls, mock_engine = _mock_invisible_engine()
output = tmp_path / "clean.png"
with (
patch("remove_ai_watermarks.invisible_engine.is_available", return_value=True),
patch("remove_ai_watermarks.cli.InvisibleEngine", mock_cls, create=True),
patch("remove_ai_watermarks.invisible_engine.InvisibleEngine", mock_cls),
):
@@ -263,6 +264,7 @@ class TestInvisibleCommand:
def test_invisible_default_output(self, runner, sample_png):
mock_cls, _mock_engine = _mock_invisible_engine()
with (
patch("remove_ai_watermarks.invisible_engine.is_available", return_value=True),
patch("remove_ai_watermarks.cli.InvisibleEngine", mock_cls, create=True),
patch("remove_ai_watermarks.invisible_engine.InvisibleEngine", mock_cls),
):
+9 -3
View File
@@ -12,9 +12,15 @@ class TestIsAvailable:
result = is_available()
assert isinstance(result, bool)
def test_available_when_torch_installed(self):
"""torch + diffusers should be installed in dev env."""
assert is_available() is True
def test_available_reflects_dependencies(self):
"""is_available() is True iff torch + diffusers (the gpu extra) import.
Must not assume the full stack: the core+dev CI env has no diffusers.
"""
import importlib.util
expected = all(importlib.util.find_spec(m) is not None for m in ("torch", "diffusers"))
assert is_available() is expected
class TestInvisibleEngineInit:
+11 -3
View File
@@ -151,13 +151,21 @@ class TestAvailability:
"""Tests for dependency availability checks."""
def test_watermark_removal_available(self):
# In dev env with torch+diffusers installed
assert is_watermark_removal_available() is True
# Reflects the actual environment: True iff torch + diffusers (the gpu
# extra) are importable. The core+dev CI env has no diffusers, so this
# must not assume the full stack is present.
import importlib.util
expected = all(importlib.util.find_spec(m) is not None for m in ("torch", "diffusers"))
assert is_watermark_removal_available() is expected
def test_invisible_is_available(self):
import importlib.util
from remove_ai_watermarks.invisible_engine import is_available
assert is_available() is True
expected = all(importlib.util.find_spec(m) is not None for m in ("torch", "diffusers"))
assert is_available() is expected
# ── Platform-specific path handling ─────────────────────────────────