- palette.py + rembg.py: implement from stubs (Pillow median-cut + rembg u2net) - vlm.py: rename Spark2→steev (Strix Halo / Ollama); bump max_tokens 1024→4096 (qwen3-vl:32b thinking mode consumes budget tokens — 4096 min for valid output) - settings.py: rename spark2_vlm_*/spark1_flux_* → vlm_*/flux_*; real defaults (steev 100.88.167.87:11434 Ollama, gx10 100.90.100.10:8188 ComfyUI) - tests/: conftest.py + test_palette.py + test_rembg.py + test_integration_e2e.py (28 unit + 10 integration; 38/38 passing — VLM raw/polished/ugc + FLUX render) - CLAUDE.md: rewrite to accurate phase status + infra + layout - requirements.txt + pyproject.toml: add Pillow, rembg, pytest-asyncio deps Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
47 lines
1.3 KiB
Python
47 lines
1.3 KiB
Python
"""Shared fixtures for svrnty-vision test suite."""
|
||
|
||
from __future__ import annotations
|
||
|
||
import base64
|
||
import io
|
||
|
||
import pytest
|
||
from fastapi.testclient import TestClient
|
||
from PIL import Image
|
||
|
||
from svrnty_vision.server import app
|
||
|
||
|
||
@pytest.fixture(scope="session")
|
||
def client() -> TestClient:
|
||
return TestClient(app)
|
||
|
||
|
||
@pytest.fixture(scope="session")
|
||
def red_png_b64() -> str:
|
||
"""100×100 solid-red PNG encoded as base64 — minimal valid image for all endpoints."""
|
||
img = Image.new("RGB", (100, 100), color=(220, 50, 50))
|
||
buf = io.BytesIO()
|
||
img.save(buf, format="PNG")
|
||
return base64.b64encode(buf.getvalue()).decode("ascii")
|
||
|
||
|
||
@pytest.fixture(scope="session")
|
||
def gradient_png_b64() -> str:
|
||
"""200×200 RGB gradient — more realistic for VLM + palette tests."""
|
||
img = Image.new("RGB", (200, 200))
|
||
for x in range(200):
|
||
for y in range(200):
|
||
img.putpixel((x, y), (x, y, 128))
|
||
buf = io.BytesIO()
|
||
img.save(buf, format="PNG")
|
||
return base64.b64encode(buf.getvalue()).decode("ascii")
|
||
|
||
|
||
def pytest_configure(config: pytest.Config) -> None:
|
||
config.addinivalue_line(
|
||
"markers",
|
||
"integration: live service tests — require Tailscale + running Spark hosts. "
|
||
"Run with: pytest -m integration",
|
||
)
|