fix(restructure): fix test regressions from import rewrite

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
This commit is contained in:
alt-glitch 2026-04-23 12:05:10 +05:30
parent 4b16341975
commit a1e667b9f2
113 changed files with 343 additions and 345 deletions

View file

@ -3,8 +3,7 @@ import sys
def test_sessions_delete_accepts_unique_id_prefix(monkeypatch, capsys):
import hermes_agent.cli.main as main_mod
import hermes_agent.state
from hermes_agent import state as hermes_state
captured = {}
class FakeDB:
@ -39,8 +38,7 @@ def test_sessions_delete_accepts_unique_id_prefix(monkeypatch, capsys):
def test_sessions_delete_reports_not_found_when_prefix_is_unknown(monkeypatch, capsys):
import hermes_agent.cli.main as main_mod
import hermes_agent.state
from hermes_agent import state as hermes_state
class FakeDB:
def resolve_session_id(self, session_id):
return None
@ -67,8 +65,7 @@ def test_sessions_delete_reports_not_found_when_prefix_is_unknown(monkeypatch, c
def test_sessions_delete_handles_eoferror_on_confirm(monkeypatch, capsys):
"""sessions delete should not crash when stdin is closed (non-TTY)."""
import hermes_agent.cli.main as main_mod
import hermes_agent.state
from hermes_agent import state as hermes_state
class FakeDB:
def resolve_session_id(self, session_id):
return "20260315_092437_c9a6ff"
@ -95,8 +92,7 @@ def test_sessions_delete_handles_eoferror_on_confirm(monkeypatch, capsys):
def test_sessions_prune_handles_eoferror_on_confirm(monkeypatch, capsys):
"""sessions prune should not crash when stdin is closed (non-TTY)."""
import hermes_agent.cli.main as main_mod
import hermes_agent.state
from hermes_agent import state as hermes_state
class FakeDB:
def prune_sessions(self, **kwargs):
raise AssertionError("prune_sessions should not be called when cancelled")