mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-25 00:51:20 +00:00
Fix variable name breakage (run_agent, hermes_constants, etc.) where import rewriter changed 'import X' to 'import hermes_agent.Y' but test code still referenced 'X' as a variable name. Fix package-vs-module confusion (cli.auth, cli.models, cli.ui) where single files became directories. Fix hardcoded file paths in tests pointing to old locations. Fix tool registry to discover tools in subpackage directories. Fix stale import in hermes_agent/tools/__init__.py. Part of #14182, #14183
70 lines
2.5 KiB
Python
70 lines
2.5 KiB
Python
"""Tests for banner toolset name normalization and skin color usage."""
|
|
|
|
from unittest.mock import patch
|
|
|
|
from rich.console import Console
|
|
|
|
import hermes_agent.cli.ui.banner as banner
|
|
from hermes_agent.tools import dispatch as model_tools
|
|
from hermes_agent.tools.mcp import tool as mcp_tool
|
|
|
|
|
|
def test_display_toolset_name_strips_legacy_suffix():
|
|
assert banner._display_toolset_name("homeassistant_tools") == "homeassistant"
|
|
assert banner._display_toolset_name("honcho_tools") == "honcho"
|
|
assert banner._display_toolset_name("web_tools") == "web"
|
|
|
|
|
|
def test_display_toolset_name_preserves_clean_names():
|
|
assert banner._display_toolset_name("browser") == "browser"
|
|
assert banner._display_toolset_name("file") == "file"
|
|
assert banner._display_toolset_name("terminal") == "terminal"
|
|
|
|
|
|
def test_display_toolset_name_handles_empty():
|
|
assert banner._display_toolset_name("") == "unknown"
|
|
assert banner._display_toolset_name(None) == "unknown"
|
|
|
|
|
|
def test_build_welcome_banner_uses_normalized_toolset_names():
|
|
"""Unavailable toolsets should not have '_tools' appended in banner output."""
|
|
with (
|
|
patch.object(
|
|
model_tools,
|
|
"check_tool_availability",
|
|
return_value=(
|
|
["web"],
|
|
[
|
|
{"name": "homeassistant", "tools": ["ha_call_service"]},
|
|
{"name": "honcho", "tools": ["honcho_conclude"]},
|
|
],
|
|
),
|
|
),
|
|
patch.object(banner, "get_available_skills", return_value={}),
|
|
patch.object(banner, "get_update_result", return_value=None),
|
|
patch.object(mcp_tool, "get_mcp_status", return_value=[]),
|
|
):
|
|
console = Console(
|
|
record=True, force_terminal=False, color_system=None, width=160
|
|
)
|
|
banner.build_welcome_banner(
|
|
console=console,
|
|
model="anthropic/test-model",
|
|
cwd="/tmp/project",
|
|
tools=[
|
|
{"function": {"name": "web_search"}},
|
|
{"function": {"name": "read_file"}},
|
|
],
|
|
get_toolset_for_tool=lambda name: {
|
|
"web_search": "web_tools",
|
|
"read_file": "file",
|
|
}.get(name),
|
|
)
|
|
|
|
output = console.export_text()
|
|
assert "homeassistant:" in output
|
|
assert "honcho:" in output
|
|
assert "web:" in output
|
|
assert "homeassistant_tools:" not in output
|
|
assert "honcho_tools:" not in output
|
|
assert "web_tools:" not in output
|