mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-06-09 08:21:50 +00:00
refactor(tests): re-architect tests + fix CI failures (#5946)
* refactor: re-architect tests to mirror the codebase
* Update tests.yml
* fix: add missing tool_error imports after registry refactor
* fix(tests): replace patch.dict with monkeypatch to prevent env var leaks under xdist
patch.dict(os.environ) can leak TERMINAL_ENV across xdist workers,
causing test_code_execution tests to hit the Modal remote path.
* fix(tests): fix update_check and telegram xdist failures
- test_update_check: replace patch("hermes_cli.banner.os.getenv") with
monkeypatch.setenv("HERMES_HOME") — banner.py no longer imports os
directly, it uses get_hermes_home() from hermes_constants.
- test_telegram_conflict/approval_buttons: provide real exception classes
for telegram.error mock (NetworkError, TimedOut, BadRequest) so the
except clause in connect() doesn't fail with "catching classes that do
not inherit from BaseException" when xdist pollutes sys.modules.
* fix(tests): accept unavailable_models kwarg in _prompt_model_selection mock
This commit is contained in:
parent
99ff375f7a
commit
f3006ebef9
110 changed files with 153 additions and 150 deletions
|
|
@ -34,6 +34,7 @@ import requests
|
|||
|
||||
from hermes_cli.config import load_config
|
||||
from tools.browser_camofox_state import get_camofox_identity
|
||||
from tools.registry import tool_error
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
|||
|
|
@ -1317,6 +1317,8 @@ def _make_read_resource_handler(server_name: str, tool_timeout: float):
|
|||
"""Return a sync handler that reads a resource by URI from an MCP server."""
|
||||
|
||||
def _handler(args: dict, **kwargs) -> str:
|
||||
from tools.registry import tool_error
|
||||
|
||||
with _lock:
|
||||
server = _servers.get(server_name)
|
||||
if not server or not server.session:
|
||||
|
|
@ -1406,6 +1408,8 @@ def _make_get_prompt_handler(server_name: str, tool_timeout: float):
|
|||
"""Return a sync handler that gets a prompt by name from an MCP server."""
|
||||
|
||||
def _handler(args: dict, **kwargs) -> str:
|
||||
from tools.registry import tool_error
|
||||
|
||||
with _lock:
|
||||
server = _servers.get(server_name)
|
||||
if not server or not server.session:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue