chore: rename bulkgen to hokusai
This commit is contained in:
parent
a28cc97aed
commit
4def49350e
32 changed files with 215 additions and 213 deletions
|
|
@ -1,4 +1,4 @@
|
|||
"""Shared fixtures for bulkgen integration tests."""
|
||||
"""Shared fixtures for hokusai integration tests."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
|
|
@ -8,7 +8,7 @@ from pathlib import Path
|
|||
import pytest
|
||||
import yaml
|
||||
|
||||
from bulkgen.config import ProjectConfig, load_config
|
||||
from hokusai.config import ProjectConfig, load_config
|
||||
|
||||
WriteConfig = Callable[[dict[str, object]], ProjectConfig]
|
||||
|
||||
|
|
@ -21,7 +21,7 @@ def project_dir(tmp_path: Path) -> Path:
|
|||
|
||||
@pytest.fixture
|
||||
def write_config(project_dir: Path) -> WriteConfig:
|
||||
"""Write a bulkgen YAML config and return the loaded ProjectConfig.
|
||||
"""Write a hokusai YAML config and return the loaded ProjectConfig.
|
||||
|
||||
Usage::
|
||||
|
||||
|
|
@ -29,7 +29,7 @@ def write_config(project_dir: Path) -> WriteConfig:
|
|||
"""
|
||||
|
||||
def _write(raw: dict[str, object]) -> ProjectConfig:
|
||||
config_path = project_dir / "project.bulkgen.yaml"
|
||||
config_path = project_dir / "project.hokusai.yaml"
|
||||
_ = config_path.write_text(yaml.dump(raw, default_flow_style=False))
|
||||
return load_config(config_path)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
"""Integration tests for bulkgen.builder."""
|
||||
"""Integration tests for hokusai.builder."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
|
|
@ -9,17 +9,17 @@ from unittest.mock import patch
|
|||
|
||||
import pytest
|
||||
|
||||
from bulkgen.builder import (
|
||||
from hokusai.builder import (
|
||||
_collect_all_deps, # pyright: ignore[reportPrivateUsage]
|
||||
_collect_dep_files, # pyright: ignore[reportPrivateUsage]
|
||||
_collect_extra_params, # pyright: ignore[reportPrivateUsage]
|
||||
_resolve_prompt, # pyright: ignore[reportPrivateUsage]
|
||||
run_build,
|
||||
)
|
||||
from bulkgen.config import ProjectConfig, TargetConfig
|
||||
from bulkgen.providers import Provider
|
||||
from bulkgen.providers.models import Capability, ModelInfo
|
||||
from bulkgen.state import load_state
|
||||
from hokusai.config import ProjectConfig, TargetConfig
|
||||
from hokusai.providers import Provider
|
||||
from hokusai.providers.models import Capability, ModelInfo
|
||||
from hokusai.state import load_state
|
||||
|
||||
WriteConfig = Callable[[dict[str, object]], ProjectConfig]
|
||||
|
||||
|
|
@ -197,7 +197,7 @@ class TestRunBuild:
|
|||
async def test_build_single_text_target(
|
||||
self, project_dir: Path, simple_text_config: ProjectConfig
|
||||
) -> None:
|
||||
with patch("bulkgen.builder._create_providers", return_value=_fake_providers()):
|
||||
with patch("hokusai.builder._create_providers", return_value=_fake_providers()):
|
||||
result = await run_build(simple_text_config, project_dir, _PROJECT)
|
||||
|
||||
assert result.built == ["output.txt"]
|
||||
|
|
@ -208,7 +208,7 @@ class TestRunBuild:
|
|||
async def test_build_chain_dependency(
|
||||
self, project_dir: Path, multi_target_config: ProjectConfig
|
||||
) -> None:
|
||||
with patch("bulkgen.builder._create_providers", return_value=_fake_providers()):
|
||||
with patch("hokusai.builder._create_providers", return_value=_fake_providers()):
|
||||
result = await run_build(multi_target_config, project_dir, _PROJECT)
|
||||
|
||||
assert "summary.md" in result.built
|
||||
|
|
@ -223,7 +223,7 @@ class TestRunBuild:
|
|||
async def test_incremental_build_skips_clean_targets(
|
||||
self, project_dir: Path, simple_text_config: ProjectConfig
|
||||
) -> None:
|
||||
with patch("bulkgen.builder._create_providers", return_value=_fake_providers()):
|
||||
with patch("hokusai.builder._create_providers", return_value=_fake_providers()):
|
||||
result1 = await run_build(simple_text_config, project_dir, _PROJECT)
|
||||
assert result1.built == ["output.txt"]
|
||||
|
||||
|
|
@ -235,7 +235,7 @@ class TestRunBuild:
|
|||
self, project_dir: Path, write_config: WriteConfig
|
||||
) -> None:
|
||||
config1 = write_config({"targets": {"out.txt": {"prompt": "version 1"}}})
|
||||
with patch("bulkgen.builder._create_providers", return_value=_fake_providers()):
|
||||
with patch("hokusai.builder._create_providers", return_value=_fake_providers()):
|
||||
r1 = await run_build(config1, project_dir, _PROJECT)
|
||||
assert r1.built == ["out.txt"]
|
||||
|
||||
|
|
@ -250,7 +250,7 @@ class TestRunBuild:
|
|||
config = write_config(
|
||||
{"targets": {"out.md": {"prompt": "x", "inputs": ["data.txt"]}}}
|
||||
)
|
||||
with patch("bulkgen.builder._create_providers", return_value=_fake_providers()):
|
||||
with patch("hokusai.builder._create_providers", return_value=_fake_providers()):
|
||||
r1 = await run_build(config, project_dir, _PROJECT)
|
||||
assert r1.built == ["out.md"]
|
||||
|
||||
|
|
@ -261,7 +261,7 @@ class TestRunBuild:
|
|||
async def test_selective_build_single_target(
|
||||
self, project_dir: Path, multi_target_config: ProjectConfig
|
||||
) -> None:
|
||||
with patch("bulkgen.builder._create_providers", return_value=_fake_providers()):
|
||||
with patch("hokusai.builder._create_providers", return_value=_fake_providers()):
|
||||
result = await run_build(
|
||||
multi_target_config, project_dir, _PROJECT, target="summary.md"
|
||||
)
|
||||
|
|
@ -273,7 +273,7 @@ class TestRunBuild:
|
|||
async def test_selective_build_unknown_target_raises(
|
||||
self, project_dir: Path, simple_text_config: ProjectConfig
|
||||
) -> None:
|
||||
with patch("bulkgen.builder._create_providers", return_value=_fake_providers()):
|
||||
with patch("hokusai.builder._create_providers", return_value=_fake_providers()):
|
||||
with pytest.raises(ValueError, match="Unknown target"):
|
||||
_ = await run_build(
|
||||
simple_text_config, project_dir, _PROJECT, target="nonexistent.txt"
|
||||
|
|
@ -321,7 +321,7 @@ class TestRunBuild:
|
|||
routing_provider.generate = selective_generate # type: ignore[assignment]
|
||||
|
||||
with patch(
|
||||
"bulkgen.builder._create_providers",
|
||||
"hokusai.builder._create_providers",
|
||||
return_value=[routing_provider, FakeImageProvider()],
|
||||
):
|
||||
result = await run_build(config, project_dir, _PROJECT)
|
||||
|
|
@ -342,7 +342,7 @@ class TestRunBuild:
|
|||
)
|
||||
|
||||
with patch(
|
||||
"bulkgen.builder._create_providers",
|
||||
"hokusai.builder._create_providers",
|
||||
return_value=[FailingTextProvider(), FakeImageProvider()],
|
||||
):
|
||||
result = await run_build(config, project_dir, _PROJECT)
|
||||
|
|
@ -355,7 +355,7 @@ class TestRunBuild:
|
|||
self, project_dir: Path, simple_text_config: ProjectConfig
|
||||
) -> None:
|
||||
with patch(
|
||||
"bulkgen.builder._create_providers",
|
||||
"hokusai.builder._create_providers",
|
||||
return_value=[],
|
||||
):
|
||||
result = await run_build(simple_text_config, project_dir, _PROJECT)
|
||||
|
|
@ -374,7 +374,7 @@ class TestRunBuild:
|
|||
}
|
||||
}
|
||||
)
|
||||
with patch("bulkgen.builder._create_providers", return_value=_fake_providers()):
|
||||
with patch("hokusai.builder._create_providers", return_value=_fake_providers()):
|
||||
_ = await run_build(config, project_dir, _PROJECT)
|
||||
|
||||
state = load_state(project_dir, _PROJECT)
|
||||
|
|
@ -386,7 +386,7 @@ class TestRunBuild:
|
|||
) -> None:
|
||||
config = write_config({"targets": {"out.txt": {"prompt": prompt_file.name}}})
|
||||
|
||||
with patch("bulkgen.builder._create_providers", return_value=_fake_providers()):
|
||||
with patch("hokusai.builder._create_providers", return_value=_fake_providers()):
|
||||
result = await run_build(config, project_dir, _PROJECT)
|
||||
|
||||
assert result.built == ["out.txt"]
|
||||
|
|
@ -396,7 +396,7 @@ class TestRunBuild:
|
|||
async def test_rebuild_after_output_deleted(
|
||||
self, project_dir: Path, simple_text_config: ProjectConfig
|
||||
) -> None:
|
||||
with patch("bulkgen.builder._create_providers", return_value=_fake_providers()):
|
||||
with patch("hokusai.builder._create_providers", return_value=_fake_providers()):
|
||||
r1 = await run_build(simple_text_config, project_dir, _PROJECT)
|
||||
assert r1.built == ["output.txt"]
|
||||
|
||||
|
|
@ -421,7 +421,7 @@ class TestRunBuild:
|
|||
}
|
||||
}
|
||||
)
|
||||
with patch("bulkgen.builder._create_providers", return_value=_fake_providers()):
|
||||
with patch("hokusai.builder._create_providers", return_value=_fake_providers()):
|
||||
result = await run_build(config, project_dir, _PROJECT)
|
||||
|
||||
assert set(result.built) == {"left.md", "right.md", "merge.txt"}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
"""Integration tests for bulkgen.cli.
|
||||
"""Integration tests for hokusai.cli.
|
||||
|
||||
Patching ``Path.cwd()`` produces Any-typed return values from mock objects.
|
||||
"""
|
||||
|
|
@ -13,8 +13,8 @@ import pytest
|
|||
import yaml
|
||||
from typer.testing import CliRunner
|
||||
|
||||
from bulkgen.builder import BuildResult
|
||||
from bulkgen.cli import app
|
||||
from hokusai.builder import BuildResult
|
||||
from hokusai.cli import app
|
||||
|
||||
runner = CliRunner()
|
||||
|
||||
|
|
@ -28,7 +28,7 @@ def cli_project(tmp_path: Path) -> Path:
|
|||
"image.png": {"prompt": "Generate image"},
|
||||
}
|
||||
}
|
||||
_ = (tmp_path / "project.bulkgen.yaml").write_text(
|
||||
_ = (tmp_path / "project.hokusai.yaml").write_text(
|
||||
yaml.dump(config, default_flow_style=False)
|
||||
)
|
||||
return tmp_path
|
||||
|
|
@ -38,24 +38,24 @@ class TestFindConfig:
|
|||
"""Test config file discovery."""
|
||||
|
||||
def test_no_config_file(self, tmp_path: Path) -> None:
|
||||
with patch("bulkgen.cli.Path") as mock_path_cls:
|
||||
with patch("hokusai.cli.Path") as mock_path_cls:
|
||||
mock_path_cls.cwd.return_value = tmp_path
|
||||
result = runner.invoke(app, ["build"])
|
||||
assert result.exit_code != 0
|
||||
assert "No .bulkgen.yaml file found" in result.output
|
||||
assert "No .hokusai.yaml file found" in result.output
|
||||
|
||||
def test_multiple_config_files(self, tmp_path: Path) -> None:
|
||||
_ = (tmp_path / "a.bulkgen.yaml").write_text(
|
||||
_ = (tmp_path / "a.hokusai.yaml").write_text(
|
||||
yaml.dump({"targets": {"x.txt": {"prompt": "a"}}})
|
||||
)
|
||||
_ = (tmp_path / "b.bulkgen.yaml").write_text(
|
||||
_ = (tmp_path / "b.hokusai.yaml").write_text(
|
||||
yaml.dump({"targets": {"y.txt": {"prompt": "b"}}})
|
||||
)
|
||||
with patch("bulkgen.cli.Path") as mock_path_cls:
|
||||
with patch("hokusai.cli.Path") as mock_path_cls:
|
||||
mock_path_cls.cwd.return_value = tmp_path
|
||||
result = runner.invoke(app, ["build"])
|
||||
assert result.exit_code != 0
|
||||
assert "Multiple .bulkgen.yaml files found" in result.output
|
||||
assert "Multiple .hokusai.yaml files found" in result.output
|
||||
|
||||
|
||||
class TestBuildCommand:
|
||||
|
|
@ -66,9 +66,9 @@ class TestBuildCommand:
|
|||
built=["output.txt", "image.png"], skipped=[], failed={}
|
||||
)
|
||||
with (
|
||||
patch("bulkgen.cli.Path") as mock_path_cls,
|
||||
patch("hokusai.cli.Path") as mock_path_cls,
|
||||
patch(
|
||||
"bulkgen.cli.run_build",
|
||||
"hokusai.cli.run_build",
|
||||
new_callable=AsyncMock,
|
||||
return_value=build_result,
|
||||
),
|
||||
|
|
@ -84,9 +84,9 @@ class TestBuildCommand:
|
|||
built=[], skipped=["output.txt", "image.png"], failed={}
|
||||
)
|
||||
with (
|
||||
patch("bulkgen.cli.Path") as mock_path_cls,
|
||||
patch("hokusai.cli.Path") as mock_path_cls,
|
||||
patch(
|
||||
"bulkgen.cli.run_build",
|
||||
"hokusai.cli.run_build",
|
||||
new_callable=AsyncMock,
|
||||
return_value=build_result,
|
||||
),
|
||||
|
|
@ -104,9 +104,9 @@ class TestBuildCommand:
|
|||
failed={"image.png": "Missing BFL_API_KEY"},
|
||||
)
|
||||
with (
|
||||
patch("bulkgen.cli.Path") as mock_path_cls,
|
||||
patch("hokusai.cli.Path") as mock_path_cls,
|
||||
patch(
|
||||
"bulkgen.cli.run_build",
|
||||
"hokusai.cli.run_build",
|
||||
new_callable=AsyncMock,
|
||||
return_value=build_result,
|
||||
),
|
||||
|
|
@ -120,9 +120,9 @@ class TestBuildCommand:
|
|||
def test_build_specific_target(self, cli_project: Path) -> None:
|
||||
build_result = BuildResult(built=["output.txt"], skipped=[], failed={})
|
||||
with (
|
||||
patch("bulkgen.cli.Path") as mock_path_cls,
|
||||
patch("hokusai.cli.Path") as mock_path_cls,
|
||||
patch(
|
||||
"bulkgen.cli.run_build",
|
||||
"hokusai.cli.run_build",
|
||||
new_callable=AsyncMock,
|
||||
return_value=build_result,
|
||||
) as mock_run,
|
||||
|
|
@ -142,10 +142,10 @@ class TestCleanCommand:
|
|||
def test_clean_removes_targets(self, cli_project: Path) -> None:
|
||||
_ = (cli_project / "output.txt").write_text("generated")
|
||||
_ = (cli_project / "image.png").write_bytes(b"\x89PNG")
|
||||
state_file = ".project.bulkgen-state.yaml"
|
||||
state_file = ".project.hokusai-state.yaml"
|
||||
_ = (cli_project / state_file).write_text("targets: {}")
|
||||
|
||||
with patch("bulkgen.cli.Path") as mock_path_cls:
|
||||
with patch("hokusai.cli.Path") as mock_path_cls:
|
||||
mock_path_cls.cwd.return_value = cli_project
|
||||
result = runner.invoke(app, ["clean"])
|
||||
|
||||
|
|
@ -156,7 +156,7 @@ class TestCleanCommand:
|
|||
assert "Cleaned 2 artifact(s)" in result.output
|
||||
|
||||
def test_clean_no_artifacts(self, cli_project: Path) -> None:
|
||||
with patch("bulkgen.cli.Path") as mock_path_cls:
|
||||
with patch("hokusai.cli.Path") as mock_path_cls:
|
||||
mock_path_cls.cwd.return_value = cli_project
|
||||
result = runner.invoke(app, ["clean"])
|
||||
|
||||
|
|
@ -166,7 +166,7 @@ class TestCleanCommand:
|
|||
def test_clean_partial_artifacts(self, cli_project: Path) -> None:
|
||||
_ = (cli_project / "output.txt").write_text("generated")
|
||||
|
||||
with patch("bulkgen.cli.Path") as mock_path_cls:
|
||||
with patch("hokusai.cli.Path") as mock_path_cls:
|
||||
mock_path_cls.cwd.return_value = cli_project
|
||||
result = runner.invoke(app, ["clean"])
|
||||
|
||||
|
|
@ -180,10 +180,10 @@ class TestGraphCommand:
|
|||
|
||||
def test_graph_single_target(self, tmp_path: Path) -> None:
|
||||
config = {"targets": {"out.txt": {"prompt": "hello"}}}
|
||||
_ = (tmp_path / "test.bulkgen.yaml").write_text(
|
||||
_ = (tmp_path / "test.hokusai.yaml").write_text(
|
||||
yaml.dump(config, default_flow_style=False)
|
||||
)
|
||||
with patch("bulkgen.cli.Path") as mock_path_cls:
|
||||
with patch("hokusai.cli.Path") as mock_path_cls:
|
||||
mock_path_cls.cwd.return_value = tmp_path
|
||||
result = runner.invoke(app, ["graph"])
|
||||
|
||||
|
|
@ -198,10 +198,10 @@ class TestGraphCommand:
|
|||
"step2.txt": {"prompt": "y", "inputs": ["step1.md"]},
|
||||
}
|
||||
}
|
||||
_ = (tmp_path / "test.bulkgen.yaml").write_text(
|
||||
_ = (tmp_path / "test.hokusai.yaml").write_text(
|
||||
yaml.dump(config, default_flow_style=False)
|
||||
)
|
||||
with patch("bulkgen.cli.Path") as mock_path_cls:
|
||||
with patch("hokusai.cli.Path") as mock_path_cls:
|
||||
mock_path_cls.cwd.return_value = tmp_path
|
||||
result = runner.invoke(app, ["graph"])
|
||||
|
||||
|
|
@ -219,10 +219,10 @@ class TestGraphCommand:
|
|||
"b.txt": {"prompt": "y", "inputs": ["a.txt"]},
|
||||
}
|
||||
}
|
||||
_ = (tmp_path / "test.bulkgen.yaml").write_text(
|
||||
_ = (tmp_path / "test.hokusai.yaml").write_text(
|
||||
yaml.dump(config, default_flow_style=False)
|
||||
)
|
||||
with patch("bulkgen.cli.Path") as mock_path_cls:
|
||||
with patch("hokusai.cli.Path") as mock_path_cls:
|
||||
mock_path_cls.cwd.return_value = tmp_path
|
||||
result = runner.invoke(app, ["graph"])
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
"""Integration tests for bulkgen.config."""
|
||||
"""Integration tests for hokusai.config."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
|
|
@ -7,14 +7,14 @@ from pathlib import Path
|
|||
import pytest
|
||||
import yaml
|
||||
|
||||
from bulkgen.config import load_config
|
||||
from hokusai.config import load_config
|
||||
|
||||
|
||||
class TestLoadConfig:
|
||||
"""Test loading and validating YAML config files end-to-end."""
|
||||
|
||||
def test_minimal_config(self, project_dir: Path) -> None:
|
||||
config_path = project_dir / "test.bulkgen.yaml"
|
||||
config_path = project_dir / "test.hokusai.yaml"
|
||||
_ = config_path.write_text(
|
||||
yaml.dump({"targets": {"out.txt": {"prompt": "hello"}}})
|
||||
)
|
||||
|
|
@ -47,7 +47,7 @@ class TestLoadConfig:
|
|||
},
|
||||
},
|
||||
}
|
||||
config_path = project_dir / "full.bulkgen.yaml"
|
||||
config_path = project_dir / "full.hokusai.yaml"
|
||||
_ = config_path.write_text(yaml.dump(raw, default_flow_style=False))
|
||||
|
||||
config = load_config(config_path)
|
||||
|
|
@ -67,14 +67,14 @@ class TestLoadConfig:
|
|||
assert story.inputs == ["banner.png"]
|
||||
|
||||
def test_empty_targets_rejected(self, project_dir: Path) -> None:
|
||||
config_path = project_dir / "empty.bulkgen.yaml"
|
||||
config_path = project_dir / "empty.hokusai.yaml"
|
||||
_ = config_path.write_text(yaml.dump({"targets": {}}))
|
||||
|
||||
with pytest.raises(Exception, match="At least one target"):
|
||||
_ = load_config(config_path)
|
||||
|
||||
def test_missing_prompt_rejected(self, project_dir: Path) -> None:
|
||||
config_path = project_dir / "bad.bulkgen.yaml"
|
||||
config_path = project_dir / "bad.hokusai.yaml"
|
||||
_ = config_path.write_text(yaml.dump({"targets": {"out.txt": {}}}))
|
||||
|
||||
with pytest.raises(Exception):
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
"""Integration tests for bulkgen.graph."""
|
||||
"""Integration tests for hokusai.graph."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
|
|
@ -7,8 +7,8 @@ from pathlib import Path
|
|||
|
||||
import pytest
|
||||
|
||||
from bulkgen.config import ProjectConfig
|
||||
from bulkgen.graph import build_graph, get_build_order, get_subgraph_for_target
|
||||
from hokusai.config import ProjectConfig
|
||||
from hokusai.graph import build_graph, get_build_order, get_subgraph_for_target
|
||||
|
||||
WriteConfig = Callable[[dict[str, object]], ProjectConfig]
|
||||
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
|
|
|
|||
|
|
@ -1,15 +1,15 @@
|
|||
"""Integration tests for bulkgen.config."""
|
||||
"""Integration tests for hokusai.config."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
from bulkgen.config import (
|
||||
from hokusai.config import (
|
||||
Defaults,
|
||||
TargetConfig,
|
||||
)
|
||||
from bulkgen.providers.models import Capability
|
||||
from bulkgen.resolve import infer_required_capabilities, resolve_model
|
||||
from hokusai.providers.models import Capability
|
||||
from hokusai.resolve import infer_required_capabilities, resolve_model
|
||||
|
||||
|
||||
class TestInferRequiredCapabilities:
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
"""Integration tests for bulkgen.state."""
|
||||
"""Integration tests for hokusai.state."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
|
|
@ -6,7 +6,7 @@ from pathlib import Path
|
|||
|
||||
import yaml
|
||||
|
||||
from bulkgen.state import (
|
||||
from hokusai.state import (
|
||||
BuildState,
|
||||
TargetState,
|
||||
hash_file,
|
||||
|
|
@ -41,10 +41,10 @@ class TestStateFilename:
|
|||
"""Test state filename derivation."""
|
||||
|
||||
def test_state_filename(self) -> None:
|
||||
assert state_filename("cards") == ".cards.bulkgen-state.yaml"
|
||||
assert state_filename("cards") == ".cards.hokusai-state.yaml"
|
||||
|
||||
def test_state_filename_simple(self) -> None:
|
||||
assert state_filename("project") == ".project.bulkgen-state.yaml"
|
||||
assert state_filename("project") == ".project.hokusai-state.yaml"
|
||||
|
||||
|
||||
class TestStatePersistence:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue