Phase 0: project skeleton
- pyproject.toml with uv, deps for runtime + gui + backtest + dev - ruff/mypy strict config, pre-commit hooks for ruff/mypy/pytest - src/cerbero_bite/ layout with empty modules ready for Phase 1+ - structlog JSONL logger with daily rotation - click CLI with placeholder subcommands (status, start, kill-switch, gui, replay, config hash, audit verify) - 6 smoke tests passing, mypy --strict clean, ruff clean Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
"""Shared pytest fixtures for Cerbero Bite tests."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Iterator
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def tmp_data_dir(tmp_path: Path) -> Iterator[Path]:
|
||||
"""Isolated data directory with the standard subfolder layout."""
|
||||
data = tmp_path / "data"
|
||||
(data / "log").mkdir(parents=True)
|
||||
(data / "backups").mkdir()
|
||||
yield data
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def project_root() -> Path:
|
||||
"""Path to the project root (parent of ``src/``)."""
|
||||
return Path(__file__).resolve().parent.parent
|
||||
Vendored
@@ -0,0 +1,55 @@
|
||||
"""Smoke tests: package importable, version exposed, CLI invokable."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from click.testing import CliRunner
|
||||
|
||||
import cerbero_bite
|
||||
from cerbero_bite import __version__
|
||||
from cerbero_bite.cli import main as cli_main
|
||||
|
||||
|
||||
def test_package_version_string() -> None:
|
||||
assert isinstance(__version__, str)
|
||||
assert __version__.count(".") == 2
|
||||
|
||||
|
||||
def test_package_module_attribute() -> None:
|
||||
assert cerbero_bite.__version__ == __version__
|
||||
|
||||
|
||||
def test_cli_help_lists_status_command() -> None:
|
||||
runner = CliRunner()
|
||||
result = runner.invoke(cli_main, ["--help"])
|
||||
assert result.exit_code == 0
|
||||
assert "status" in result.output
|
||||
|
||||
|
||||
def test_cli_status_runs(tmp_data_dir: Path) -> None:
|
||||
runner = CliRunner()
|
||||
result = runner.invoke(
|
||||
cli_main,
|
||||
["--log-dir", str(tmp_data_dir / "log"), "status"],
|
||||
)
|
||||
assert result.exit_code == 0
|
||||
assert "Cerbero Bite" in result.output
|
||||
assert "phase: 0" in result.output
|
||||
|
||||
|
||||
def test_cli_kill_switch_arm_placeholder(tmp_data_dir: Path) -> None:
|
||||
runner = CliRunner()
|
||||
result = runner.invoke(
|
||||
cli_main,
|
||||
["--log-dir", str(tmp_data_dir / "log"), "kill-switch", "arm", "--reason", "test"],
|
||||
)
|
||||
assert result.exit_code == 0
|
||||
assert "phase 0 placeholder" in result.output
|
||||
|
||||
|
||||
def test_cli_version_flag() -> None:
|
||||
runner = CliRunner()
|
||||
result = runner.invoke(cli_main, ["--version"])
|
||||
assert result.exit_code == 0
|
||||
assert __version__ in result.output
|
||||
Reference in New Issue
Block a user