From dac10103568f64f8bad00dfa13507acea6a00ecc Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Tue, 16 Dec 2025 08:50:29 +0000 Subject: [PATCH] fix: pass tools to tests to simulate real scenario MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The tests were failing because they didn't pass tools to the call() method, so self.tools was None and the function call processing was skipped. In real usage, tools are always configured when function calls are expected. Co-Authored-By: João --- lib/crewai/tests/llms/google/test_google.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/lib/crewai/tests/llms/google/test_google.py b/lib/crewai/tests/llms/google/test_google.py index 0c1171b09..8ca950dbc 100644 --- a/lib/crewai/tests/llms/google/test_google.py +++ b/lib/crewai/tests/llms/google/test_google.py @@ -768,8 +768,11 @@ def test_gemini_function_call_without_text_returns_action_format(): mock_generate.return_value = mock_response + # Pass tools to simulate real scenario where tools are configured + # This sets self.tools in the completion object + tools = [{"name": "search_tool", "description": "Search for information"}] messages = [{"role": "user", "content": "What's the weather in Tokyo?"}] - result = completion.call(messages=messages) + result = completion.call(messages=messages, tools=tools) assert result is not None assert result != "" @@ -817,8 +820,10 @@ def test_gemini_function_call_with_text_returns_text(): mock_generate.return_value = mock_response + # Pass tools to simulate real scenario where tools are configured + tools = [{"name": "search_tool", "description": "Search for information"}] messages = [{"role": "user", "content": "What's the weather?"}] - result = completion.call(messages=messages) + result = completion.call(messages=messages, tools=tools) assert result is not None assert result != "" @@ -866,9 +871,12 @@ def test_gemini_function_call_with_available_functions_executes_tool(): mock_generate.return_value = mock_response + # Pass tools to simulate real scenario where tools are configured + tools = [{"name": "search_tool", "description": "Search for information"}] messages = [{"role": "user", "content": "What's the weather in Tokyo?"}] result = completion.call( messages=messages, + tools=tools, available_functions=available_functions ) @@ -910,8 +918,10 @@ def test_gemini_streaming_function_call_without_text_returns_action_format(): mock_stream.return_value = [mock_chunk] + # Pass tools to simulate real scenario where tools are configured + tools = [{"name": "calculator", "description": "Calculate expressions"}] messages = [{"role": "user", "content": "Calculate 2 + 2"}] - result = completion.call(messages=messages) + result = completion.call(messages=messages, tools=tools) assert result is not None assert result != ""