pbi-cli/tests/test_errors.py
MinaSaad1 b777adec55 feat: v2.0.0 - replace MCP server with direct pythonnet/.NET TOM interop
Remove the MCP server binary dependency entirely. All 22 command groups now
connect directly to Power BI Desktop's Analysis Services engine via pythonnet
and bundled Microsoft.AnalysisServices DLLs (~20MB, in-process).

- Direct .NET TOM/ADOMD.NET interop for sub-second command execution
- 7 Claude Code skills (added Diagnostics and Partitions & Expressions)
- New commands: trace, transaction, calendar, expression, partition, advanced culture
- 91 tests passing, all skills updated, README/CHANGELOG rewritten
2026-03-27 07:19:21 +02:00

36 lines
954 B
Python

"""Tests for pbi_cli.core.errors."""
from __future__ import annotations
import click
from pbi_cli.core.errors import (
ConnectionRequiredError,
DotNetNotFoundError,
PbiCliError,
TomError,
)
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_dotnet_not_found_default_message() -> None:
err = DotNetNotFoundError()
assert "pythonnet" in err.format_message()
def test_connection_required_default_message() -> None:
err = ConnectionRequiredError()
assert "pbi connect" in err.format_message()
def test_tom_error_includes_operation() -> None:
err = TomError("measure_list", "not found")
assert "measure_list" in err.format_message()
assert "not found" in err.format_message()
assert err.operation == "measure_list"
assert err.detail == "not found"