Files
wehub-resource-sync 4b6817381b
Benchmark image — build + push to ECR (any adapter) / build + push (push) Waiting to run
CI / quality (ubuntu-latest) (push) Waiting to run
CI / test (tools-runtime) (push) Waiting to run
CI / test (e2e-general) (push) Waiting to run
CI / test (cli-runtime) (push) Waiting to run
CI / test (e2e-provider-and-openclaw) (push) Waiting to run
CI / test (integrations-and-misc) (push) Waiting to run
CI / coverage-report (push) Blocked by required conditions
CI / test-kubernetes (push) Waiting to run
CI / should-run-thorough (push) Waiting to run
CI / test-thorough (cloudwatch-demo) (push) Blocked by required conditions
CI / test-thorough (flink-ecs) (push) Blocked by required conditions
CI / test-thorough (upstream-lambda) (push) Blocked by required conditions
CI / test-thorough (prefect-ecs-fargate) (push) Blocked by required conditions
CodeQL / Analyze (python) (push) Waiting to run
Release / build-binaries (zip, opensre.exe, onefile, windows-latest, windows-x64) (push) Blocked by required conditions
Release / publish-release (push) Blocked by required conditions
Release / publish-main-release (push) Blocked by required conditions
Release / prepare (push) Waiting to run
Release / verify (push) Blocked by required conditions
Release / build-python-dist (push) Blocked by required conditions
Release / build-binaries (tar.gz, opensre, onedir, macos-15-intel, darwin-x64) (push) Blocked by required conditions
Release / build-binaries (tar.gz, opensre, onedir, macos-latest, darwin-arm64) (push) Blocked by required conditions
Release / build-binaries (tar.gz, opensre, onedir, ubuntu-22.04, linux-x64) (push) Blocked by required conditions
Release / build-binaries (tar.gz, opensre, onedir, ubuntu-22.04-arm, linux-arm64) (push) Blocked by required conditions
Synthetic Deterministic Tests / Synthetic offline (deterministic) (push) Waiting to run
Interactive Shell Live (PR + post-merge) / turn-checks (no-LLM) (push) Waiting to run
Interactive Shell Live (PR + post-merge) / turn-live shard ${{ matrix.shard_index }} (push) Waiting to run
CI (OpenClaw E2E) / openclaw test (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:10:45 +08:00

84 lines
2.5 KiB
Python

from __future__ import annotations
import click
from surfaces.cli.__main__ import cli
from surfaces.interactive_shell.ui.layout import (
RichGroup,
_options_from_command,
render_help,
render_landing,
)
def _normalized_output(output: str) -> str:
return " ".join(output.split())
def test_render_help_shows_all_registered_commands(monkeypatch, capsys) -> None:
monkeypatch.setattr("surfaces.interactive_shell.ui.banner.banner._is_first_run", lambda: True)
render_help(cli)
output = _normalized_output(capsys.readouterr().out)
assert "Usage: opensre [OPTIONS] [COMMAND] [ARGS]..." in output
assert "Commands:" in output
assert "Options:" in output
assert "Welcome back" not in output
ctx = click.Context(cli)
for name in cli.list_commands(ctx):
assert name in output
for label, description in _options_from_command(cli):
assert label in output
assert description in output
def test_render_help_includes_uninstall(capsys) -> None:
render_help(cli)
output = capsys.readouterr().out
assert "uninstall" in output
def test_render_help_command_list_matches_cli_registry(capsys) -> None:
render_help(cli)
output = _normalized_output(capsys.readouterr().out)
ctx = click.Context(cli)
for name in cli.list_commands(ctx):
assert name in output, f"command '{name}' missing from help output"
def test_render_landing_shows_header_and_examples(monkeypatch, capsys) -> None:
monkeypatch.setattr("surfaces.interactive_shell.ui.banner.banner._is_first_run", lambda: True)
render_landing(cli)
output = _normalized_output(capsys.readouterr().out)
assert "OpenSRE" in output
assert "Tips for getting started" in output
assert (
"open-source SRE agent for automated incident investigation and root cause analysis"
in output
)
assert "Usage: opensre [OPTIONS] [COMMAND] [ARGS]..." in output
assert "Quick start:" in output
assert "Options:" in output
for label, description in _options_from_command(cli):
assert label in output
assert description in output
def test_rich_group_format_help_delegates_to_render_help(monkeypatch) -> None:
called_with = []
def fake_render_help(group: click.Group) -> None:
called_with.append(group)
monkeypatch.setattr("surfaces.interactive_shell.ui.layout.render_help", fake_render_help)
group = RichGroup(name="opensre")
group.format_help(click.Context(group), click.HelpFormatter())
assert len(called_with) == 1
assert called_with[0] is group