pbi-cli/tests/test_e2e.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

50 lines
1.1 KiB
Python

"""End-to-end tests requiring the real Power BI MCP binary.
These tests are skipped in CI unless a binary is available.
Run with: pytest -m e2e
"""
from __future__ import annotations
import subprocess
import sys
import pytest
pytestmark = pytest.mark.e2e
def _pbi(*args: str) -> subprocess.CompletedProcess[str]:
"""Run a pbi command via subprocess."""
return subprocess.run(
[sys.executable, "-m", "pbi_cli", *args],
capture_output=True,
text=True,
timeout=30,
)
@pytest.fixture(autouse=True)
def _skip_if_no_binary() -> None:
"""Skip all e2e tests if the binary is not available."""
result = _pbi("--json", "setup", "--info")
if "not found" in result.stdout:
pytest.skip("Power BI MCP binary not available")
def test_version() -> None:
result = _pbi("--version")
assert result.returncode == 0
assert "pbi-cli" in result.stdout
def test_help() -> None:
result = _pbi("--help")
assert result.returncode == 0
assert "pbi-cli" in result.stdout
def test_setup_info() -> None:
result = _pbi("--json", "setup", "--info")
assert result.returncode == 0