88import unittest
99from unittest .mock import patch , MagicMock , mock_open , call
1010import pytest
11+ from pathlib import Path
12+
13+ # Add the src directory to the path for imports
14+ sys .path .insert (0 , str (Path (__file__ ).parent .parent ))
1115
1216# Check if running in CI
1317IN_CI = os .environ .get ('CI' , 'false' ).lower () == 'true'
1418
1519# Handle imports
1620try :
17- from cli_code .models .gemini import GeminiModel
1821 from rich .console import Console
1922 import google .generativeai as genai
23+ from src .cli_code .models .gemini import GeminiModel
24+ from src .cli_code .tools .base import BaseTool
25+ from src .cli_code .tools import AVAILABLE_TOOLS
2026 IMPORTS_AVAILABLE = True
2127except ImportError :
2228 IMPORTS_AVAILABLE = False
@@ -52,7 +58,7 @@ def setup_method(self):
5258 self .mock_console = MagicMock (spec = Console )
5359
5460 # Keep get_tool patch here if needed by other tests, or move into tests
55- self .get_tool_patch = patch ('cli_code.models.gemini.get_tool' )
61+ self .get_tool_patch = patch ('src. cli_code.models.gemini.get_tool' )
5662 self .mock_get_tool = self .get_tool_patch .start ()
5763 # Configure default mock tool behavior if needed by other tests
5864 self .mock_tool = MagicMock ()
@@ -186,7 +192,7 @@ def test_get_initial_context_with_ls_fallback(self, tmp_path):
186192
187193 # Act: Patch get_tool locally
188194 # Note: GeminiModel imports get_tool directly
189- with patch ('cli_code.models.gemini.get_tool' ) as mock_get_tool :
195+ with patch ('src. cli_code.models.gemini.get_tool' ) as mock_get_tool :
190196 mock_get_tool .return_value = mock_ls_tool
191197 model = GeminiModel ("fake-api-key" , self .mock_console , "gemini-pro" )
192198 context = model ._get_initial_context ()
@@ -203,7 +209,7 @@ def test_get_initial_context_with_ls_fallback(self, tmp_path):
203209 def test_create_tool_definitions (self ):
204210 """Test creation of tool definitions for Gemini."""
205211 # Create a mock for AVAILABLE_TOOLS
206- with patch ('cli_code.models.gemini.AVAILABLE_TOOLS' ) as mock_available_tools :
212+ with patch ('src. cli_code.models.gemini.AVAILABLE_TOOLS' ) as mock_available_tools :
207213 # Sample tool definition
208214 mock_available_tools .return_value = {
209215 "test_tool" : {
0 commit comments