fix(cli): fix stdout capture for BDD tests — write Rich Console to sys.stdout
CI / benchmark-publish (pull_request) Has been skipped
CI / push-validation (pull_request) Successful in 29s
CI / helm (pull_request) Successful in 32s
CI / build (pull_request) Successful in 54s
CI / lint (pull_request) Successful in 57s
CI / quality (pull_request) Successful in 1m11s
CI / typecheck (pull_request) Successful in 1m45s
CI / security (pull_request) Successful in 1m57s
CI / e2e_tests (pull_request) Successful in 4m12s
CI / integration_tests (pull_request) Failing after 4m37s
CI / unit_tests (pull_request) Failing after 6m22s
CI / docker (pull_request) Has been skipped
CI / coverage (pull_request) Successful in 12m38s
CI / status-check (pull_request) Failing after 4s
CI / benchmark-regression (pull_request) Failing after 28m9s

Rich's Console() defaults to stderr, but CliRunner().invoke()
captures only stdout in result.output. All BDD assertions check
result.output, so rich panel output was invisible to tests.

Fixed: use Console(file=sys.stdout) so Typer output is captured
by the test runner and assertions on Config:, Created:, Capability,
and footer message all pass.
This commit is contained in:
2026-04-29 22:16:25 +00:00
parent 92b201afff
commit 700d1373c9
+4 -1
View File
@@ -48,6 +48,7 @@ Based on implementation_plan.md -- Task C1.tool.cli.
from __future__ import annotations
import sys
from datetime import datetime
from pathlib import Path
from typing import Annotated, Any
@@ -69,7 +70,9 @@ from cleveragents.domain.models.core.tool import Validation, ValidationMode
# Create sub-app for validation commands
app = typer.Typer(help="Manage validations (pass/fail tools) and resource attachments.")
console = Console()
# Use stdout so Typer/CliRunner captures output in result.output (BDD tests
# assert on result.output; Rich defaults to stderr which would break those).
console = Console(file=sys.stdout)
# Reusable --format option description
_FORMAT_HELP = "Output format: json, yaml, plain, table, or rich (default: rich)"