chore: rename bulkgen to hokusai
All checks were successful
Continuous Integration / Build Package (push) Successful in 35s
Continuous Integration / Lint, Check & Test (push) Successful in 57s

This commit is contained in:
Konstantin Fickel 2026-02-20 17:08:12 +01:00
parent a28cc97aed
commit 4def49350e
Signed by: kfickel
GPG key ID: A793722F9933C1A5
32 changed files with 215 additions and 213 deletions

View file

@ -1,4 +1,4 @@
"""Integration tests for bulkgen.providers (image and text).
"""Integration tests for hokusai.providers (image and text).
Mock-heavy tests produce many Any-typed expressions from MagicMock.
"""
@ -12,16 +12,16 @@ from unittest.mock import AsyncMock, MagicMock, patch
import pytest
from bulkgen.config import TargetConfig
from bulkgen.providers.bfl import BFLResult
from bulkgen.providers.blackforest import BlackForestProvider
from bulkgen.providers.blackforest import (
from hokusai.config import TargetConfig
from hokusai.providers.bfl import BFLResult
from hokusai.providers.blackforest import BlackForestProvider
from hokusai.providers.blackforest import (
_encode_image_b64 as encode_image_b64, # pyright: ignore[reportPrivateUsage]
)
from bulkgen.providers.mistral import MistralProvider
from bulkgen.providers.models import ModelInfo
from bulkgen.providers.openai_image import OpenAIImageProvider
from bulkgen.providers.registry import get_all_models
from hokusai.providers.mistral import MistralProvider
from hokusai.providers.models import ModelInfo
from hokusai.providers.openai_image import OpenAIImageProvider
from hokusai.providers.registry import get_all_models
def _model(name: str) -> ModelInfo:
@ -85,8 +85,8 @@ class TestBlackForestProvider:
bfl_result, mock_http = _make_bfl_mocks(image_bytes)
with (
patch("bulkgen.providers.blackforest.BFLClient") as mock_cls,
patch("bulkgen.providers.blackforest.httpx.AsyncClient") as mock_http_cls,
patch("hokusai.providers.blackforest.BFLClient") as mock_cls,
patch("hokusai.providers.blackforest.httpx.AsyncClient") as mock_http_cls,
):
mock_cls.return_value.generate = AsyncMock(return_value=bfl_result)
mock_http_cls.return_value = mock_http
@ -111,8 +111,8 @@ class TestBlackForestProvider:
bfl_result, mock_http = _make_bfl_mocks(image_bytes)
with (
patch("bulkgen.providers.blackforest.BFLClient") as mock_cls,
patch("bulkgen.providers.blackforest.httpx.AsyncClient") as mock_http_cls,
patch("hokusai.providers.blackforest.BFLClient") as mock_cls,
patch("hokusai.providers.blackforest.httpx.AsyncClient") as mock_http_cls,
):
mock_generate = AsyncMock(return_value=bfl_result)
mock_cls.return_value.generate = mock_generate
@ -142,8 +142,8 @@ class TestBlackForestProvider:
bfl_result, mock_http = _make_bfl_mocks(image_bytes)
with (
patch("bulkgen.providers.blackforest.BFLClient") as mock_cls,
patch("bulkgen.providers.blackforest.httpx.AsyncClient") as mock_http_cls,
patch("hokusai.providers.blackforest.BFLClient") as mock_cls,
patch("hokusai.providers.blackforest.httpx.AsyncClient") as mock_http_cls,
):
mock_generate = AsyncMock(return_value=bfl_result)
mock_cls.return_value.generate = mock_generate
@ -177,8 +177,8 @@ class TestBlackForestProvider:
bfl_result, mock_http = _make_bfl_mocks(image_bytes)
with (
patch("bulkgen.providers.blackforest.BFLClient") as mock_cls,
patch("bulkgen.providers.blackforest.httpx.AsyncClient") as mock_http_cls,
patch("hokusai.providers.blackforest.BFLClient") as mock_cls,
patch("hokusai.providers.blackforest.httpx.AsyncClient") as mock_http_cls,
):
mock_generate = AsyncMock(return_value=bfl_result)
mock_cls.return_value.generate = mock_generate
@ -208,8 +208,8 @@ class TestBlackForestProvider:
bfl_result, mock_http = _make_bfl_mocks(image_bytes)
with (
patch("bulkgen.providers.blackforest.BFLClient") as mock_cls,
patch("bulkgen.providers.blackforest.httpx.AsyncClient") as mock_http_cls,
patch("hokusai.providers.blackforest.BFLClient") as mock_cls,
patch("hokusai.providers.blackforest.httpx.AsyncClient") as mock_http_cls,
):
mock_generate = AsyncMock(return_value=bfl_result)
mock_cls.return_value.generate = mock_generate
@ -231,8 +231,8 @@ class TestBlackForestProvider:
async def test_image_no_sample_url_raises(self, project_dir: Path) -> None:
target_config = TargetConfig(prompt="x")
with patch("bulkgen.providers.blackforest.BFLClient") as mock_cls:
from bulkgen.providers.bfl import BFLError
with patch("hokusai.providers.blackforest.BFLClient") as mock_cls:
from hokusai.providers.bfl import BFLError
mock_cls.return_value.generate = AsyncMock(
side_effect=BFLError("BFL task test ready but no sample URL: {}")
@ -264,7 +264,7 @@ class TestMistralProvider:
target_config = TargetConfig(prompt="Write a poem")
response = _make_text_response("Roses are red...")
with patch("bulkgen.providers.mistral.Mistral") as mock_cls:
with patch("hokusai.providers.mistral.Mistral") as mock_cls:
mock_cls.return_value = _make_mistral_mock(response)
provider = MistralProvider(api_key="test-key")
@ -285,7 +285,7 @@ class TestMistralProvider:
target_config = TargetConfig(prompt="Summarize", inputs=["source.txt"])
response = _make_text_response("Summary: ...")
with patch("bulkgen.providers.mistral.Mistral") as mock_cls:
with patch("hokusai.providers.mistral.Mistral") as mock_cls:
mock_client = _make_mistral_mock(response)
mock_cls.return_value = mock_client
@ -309,7 +309,7 @@ class TestMistralProvider:
target_config = TargetConfig(prompt="Describe this image", inputs=["photo.png"])
response = _make_text_response("A beautiful photo")
with patch("bulkgen.providers.mistral.Mistral") as mock_cls:
with patch("hokusai.providers.mistral.Mistral") as mock_cls:
mock_client = _make_mistral_mock(response)
mock_cls.return_value = mock_client
@ -334,7 +334,7 @@ class TestMistralProvider:
response = MagicMock()
response.choices = []
with patch("bulkgen.providers.mistral.Mistral") as mock_cls:
with patch("hokusai.providers.mistral.Mistral") as mock_cls:
mock_cls.return_value = _make_mistral_mock(response)
provider = MistralProvider(api_key="test-key")
@ -351,7 +351,7 @@ class TestMistralProvider:
target_config = TargetConfig(prompt="x")
response = _make_text_response(None)
with patch("bulkgen.providers.mistral.Mistral") as mock_cls:
with patch("hokusai.providers.mistral.Mistral") as mock_cls:
mock_cls.return_value = _make_mistral_mock(response)
provider = MistralProvider(api_key="test-key")
@ -374,7 +374,7 @@ class TestMistralProvider:
)
response = _make_text_response("Combined")
with patch("bulkgen.providers.mistral.Mistral") as mock_cls:
with patch("hokusai.providers.mistral.Mistral") as mock_cls:
mock_client = _make_mistral_mock(response)
mock_cls.return_value = mock_client
@ -405,7 +405,7 @@ class TestMistralProvider:
)
response = _make_text_response("A stylized image")
with patch("bulkgen.providers.mistral.Mistral") as mock_cls:
with patch("hokusai.providers.mistral.Mistral") as mock_cls:
mock_client = _make_mistral_mock(response)
mock_cls.return_value = mock_client
@ -459,7 +459,7 @@ class TestOpenAIImageProvider:
b64 = base64.b64encode(image_bytes).decode()
mock_client = _make_openai_mock(b64)
with patch("bulkgen.providers.openai_image.AsyncOpenAI") as mock_cls:
with patch("hokusai.providers.openai_image.AsyncOpenAI") as mock_cls:
mock_cls.return_value = mock_client
provider = OpenAIImageProvider(api_key="test-key")
@ -493,7 +493,7 @@ class TestOpenAIImageProvider:
b64 = base64.b64encode(image_bytes).decode()
mock_client = _make_openai_mock(b64)
with patch("bulkgen.providers.openai_image.AsyncOpenAI") as mock_cls:
with patch("hokusai.providers.openai_image.AsyncOpenAI") as mock_cls:
mock_cls.return_value = mock_client
provider = OpenAIImageProvider(api_key="test-key")