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 @@
|
|||
"""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"])
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue