diff --git a/tests/agent/test_prompt_builder.py b/tests/agent/test_prompt_builder.py index 6971dc9f2..80309722b 100644 --- a/tests/agent/test_prompt_builder.py +++ b/tests/agent/test_prompt_builder.py @@ -172,7 +172,11 @@ class TestBuildSkillsSystemPrompt: class TestBuildContextFilesPrompt: def test_empty_dir_returns_empty(self, tmp_path): - result = build_context_files_prompt(cwd=str(tmp_path)) + from unittest.mock import patch + fake_home = tmp_path / "fake_home" + fake_home.mkdir() + with patch("pathlib.Path.home", return_value=fake_home): + result = build_context_files_prompt(cwd=str(tmp_path)) assert result == "" def test_loads_agents_md(self, tmp_path): diff --git a/tests/test_cli_init.py b/tests/test_cli_init.py index 5fe7d477f..b26a3ff4a 100644 --- a/tests/test_cli_init.py +++ b/tests/test_cli_init.py @@ -12,8 +12,21 @@ sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..")) def _make_cli(**kwargs): """Create a HermesCLI instance with minimal mocking.""" + import cli as _cli_mod from cli import HermesCLI - with patch("cli.get_tool_definitions", return_value=[]): + _clean_config = { + "model": { + "default": "anthropic/claude-opus-4.6", + "base_url": "https://openrouter.ai/api/v1", + "provider": "auto", + }, + "display": {"compact": False, "tool_progress": "all"}, + "agent": {}, + "terminal": {"env_type": "local"}, + } + with patch("cli.get_tool_definitions", return_value=[]), \ + patch.dict("os.environ", {"LLM_MODEL": ""}, clear=False), \ + patch.dict(_cli_mod.__dict__, {"CLI_CONFIG": _clean_config}): return HermesCLI(**kwargs)