pbi-cli/tests/test_errors.py
MinaSaad1 51a23668a7 feat: add REPL mode, test suite, CI/CD, and Claude Skills (Sprints 6-8)
Sprint 6 - REPL Mode + Polish:
- Error hierarchy (PbiCliError, McpToolError, etc.) for clean REPL error handling
- Interactive REPL with prompt-toolkit (persistent MCP connection, command completion, history)
- REPL-aware run_tool() and connection commands that reuse shared client
- README.md and CHANGELOG.md

Sprint 7 - Tests + CI/CD:
- 120 tests across unit, command, and e2e test files (79% coverage)
- MockPbiMcpClient with canned responses for test isolation
- GitHub Actions CI (lint + typecheck + test matrix: 3 OS x 3 Python)
- GitHub Actions release workflow for PyPI trusted publishing

Sprint 8 - Claude Skills + Installer:
- 5 bundled SKILL.md files (modeling, dax, deployment, security, docs)
- `pbi skills install/list/uninstall` command for Claude Code discovery
- Skills packaged with wheel via setuptools package-data
2026-03-26 13:54:24 +02:00

36 lines
985 B
Python

"""Tests for pbi_cli.core.errors."""
from __future__ import annotations
import click
from pbi_cli.core.errors import (
BinaryNotFoundError,
ConnectionRequiredError,
McpToolError,
PbiCliError,
)
def test_pbi_cli_error_is_click_exception() -> None:
err = PbiCliError("test message")
assert isinstance(err, click.ClickException)
assert err.format_message() == "test message"
def test_binary_not_found_default_message() -> None:
err = BinaryNotFoundError()
assert "pbi setup" in err.format_message()
def test_connection_required_default_message() -> None:
err = ConnectionRequiredError()
assert "pbi connect" in err.format_message()
def test_mcp_tool_error_includes_tool_name() -> None:
err = McpToolError("measure_operations", "not found")
assert "measure_operations" in err.format_message()
assert "not found" in err.format_message()
assert err.tool_name == "measure_operations"
assert err.detail == "not found"