diff --git a/tests/dashboard/test_round4_fixes.py b/tests/dashboard/test_round4_fixes.py index 0de16364..f561d400 100644 --- a/tests/dashboard/test_round4_fixes.py +++ b/tests/dashboard/test_round4_fixes.py @@ -159,6 +159,8 @@ def test_create_timmy_uses_timeout_not_request_timeout(): patch("timmy.agent.Ollama") as mock_ollama, patch("timmy.agent.SqliteDb"), patch("timmy.agent.Agent"), + patch("timmy.agent._resolve_model_with_fallback", return_value=("llama3.2:3b", False)), + patch("timmy.agent._check_model_available", return_value=True), ): mock_ollama.return_value = MagicMock() diff --git a/tests/timmy/test_agent.py b/tests/timmy/test_agent.py index 55b8fb1d..7a2e5d93 100644 --- a/tests/timmy/test_agent.py +++ b/tests/timmy/test_agent.py @@ -6,6 +6,8 @@ def test_create_timmy_custom_db_file(): patch("timmy.agent.Agent"), patch("timmy.agent.Ollama"), patch("timmy.agent.SqliteDb") as MockDb, + patch("timmy.agent._resolve_model_with_fallback", return_value=("llama3.2:3b", False)), + patch("timmy.agent._check_model_available", return_value=True), ): from timmy.agent import create_timmy @@ -20,6 +22,8 @@ def test_create_timmy_embeds_system_prompt(): patch("timmy.agent.Agent") as MockAgent, patch("timmy.agent.Ollama"), patch("timmy.agent.SqliteDb"), + patch("timmy.agent._resolve_model_with_fallback", return_value=("llama3.2:3b", False)), + patch("timmy.agent._check_model_available", return_value=True), ): from timmy.agent import create_timmy @@ -44,6 +48,8 @@ def test_create_timmy_passes_ollama_url_to_model(): patch("timmy.agent.Agent"), patch("timmy.agent.Ollama") as MockOllama, patch("timmy.agent.SqliteDb"), + patch("timmy.agent._resolve_model_with_fallback", return_value=("llama3.2:3b", False)), + patch("timmy.agent._check_model_available", return_value=True), ): from timmy.agent import create_timmy @@ -64,6 +70,8 @@ def test_create_timmy_respects_custom_ollama_url(): patch("timmy.agent.Ollama") as MockOllama, patch("timmy.agent.SqliteDb"), patch("timmy.agent.settings") as mock_settings, + patch("timmy.agent._resolve_model_with_fallback", return_value=("llama3.2:3b", False)), + patch("timmy.agent._check_model_available", return_value=True), ): mock_settings.ollama_model = "llama3.2" mock_settings.ollama_url = custom_url @@ -112,6 +120,8 @@ def test_create_timmy_explicit_ollama_ignores_autodetect(): patch("timmy.agent.Agent") as MockAgent, patch("timmy.agent.Ollama"), patch("timmy.agent.SqliteDb"), + patch("timmy.agent._resolve_model_with_fallback", return_value=("llama3.2:3b", False)), + patch("timmy.agent._check_model_available", return_value=True), ): from timmy.agent import create_timmy @@ -235,6 +245,8 @@ def test_create_timmy_includes_tools_for_large_model(): patch("timmy.agent.SqliteDb"), patch("timmy.agent.create_full_toolkit", return_value=mock_toolkit), patch("timmy.agent.settings") as mock_settings, + patch("timmy.agent._resolve_model_with_fallback", return_value=("llama3.1", False)), + patch("timmy.agent._check_model_available", return_value=True), ): mock_settings.ollama_model = "llama3.1" mock_settings.ollama_url = "http://localhost:11434" @@ -260,6 +272,8 @@ def test_create_timmy_no_unsupported_agent_kwargs(): patch("timmy.agent.Agent") as MockAgent, patch("timmy.agent.Ollama"), patch("timmy.agent.SqliteDb"), + patch("timmy.agent._resolve_model_with_fallback", return_value=("llama3.2:3b", False)), + patch("timmy.agent._check_model_available", return_value=True), ): from timmy.agent import create_timmy @@ -293,6 +307,8 @@ def test_create_timmy_no_extra_kwargs(): patch("timmy.agent.Agent") as MockAgent, patch("timmy.agent.Ollama"), patch("timmy.agent.SqliteDb"), + patch("timmy.agent._resolve_model_with_fallback", return_value=("llama3.2:3b", False)), + patch("timmy.agent._check_model_available", return_value=True), ): from timmy.agent import create_timmy @@ -317,6 +333,8 @@ def test_create_timmy_skip_mcp_omits_mcp_tools(): patch("timmy.agent.SqliteDb"), patch("timmy.mcp_tools.create_gitea_mcp_tools") as mock_gitea_mcp, patch("timmy.mcp_tools.create_filesystem_mcp_tools") as mock_fs_mcp, + patch("timmy.agent._resolve_model_with_fallback", return_value=("llama3.2:3b", False)), + patch("timmy.agent._check_model_available", return_value=True), ): from timmy.agent import create_timmy @@ -335,6 +353,8 @@ def test_create_timmy_default_includes_mcp_tools(): patch("timmy.agent.SqliteDb"), patch("timmy.mcp_tools.create_gitea_mcp_tools", return_value=None) as mock_gitea_mcp, patch("timmy.mcp_tools.create_filesystem_mcp_tools", return_value=None) as mock_fs_mcp, + patch("timmy.agent._resolve_model_with_fallback", return_value=("llama3.1", False)), + patch("timmy.agent._check_model_available", return_value=True), ): from timmy.agent import create_timmy diff --git a/tests/timmy/test_ollama_timeout.py b/tests/timmy/test_ollama_timeout.py index a916343b..a17bdd44 100644 --- a/tests/timmy/test_ollama_timeout.py +++ b/tests/timmy/test_ollama_timeout.py @@ -50,6 +50,8 @@ def test_main_agent_sets_timeout(): patch("timmy.agent.Ollama") as mock_ollama, patch("timmy.agent.SqliteDb"), patch("timmy.agent.Agent"), + patch("timmy.agent._resolve_model_with_fallback", return_value=("llama3.2:3b", False)), + patch("timmy.agent._check_model_available", return_value=True), ): mock_ollama.return_value = MagicMock()