mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-09 08:08:32 +00:00
- Update regex pattern to handle Docker registry URLs with port numbers - Fix mock patches to target correct import path (crewai_tools.CodeInterpreterTool) - Fix integration test method signature for Crew._prepare_tools() - All Docker image formats now validate correctly including my-registry.com:5000/python:latest Co-Authored-By: João <joao@crewai.com>
36 lines
1001 B
Python
36 lines
1001 B
Python
from unittest.mock import patch, MagicMock
|
|
from crewai import Agent, Task, Crew
|
|
|
|
|
|
@patch('crewai_tools.CodeInterpreterTool')
|
|
def test_crew_with_custom_execution_image_integration(mock_code_interpreter_class):
|
|
"""Integration test for custom execution image in a Crew workflow."""
|
|
mock_tool_instance = MagicMock()
|
|
mock_code_interpreter_class.return_value = mock_tool_instance
|
|
|
|
agent = Agent(
|
|
role="Python Developer",
|
|
goal="Execute Python code",
|
|
backstory="Expert in Python programming",
|
|
allow_code_execution=True,
|
|
execution_image="python:3.11-slim"
|
|
)
|
|
|
|
task = Task(
|
|
description="Calculate 2 + 2",
|
|
expected_output="The result of 2 + 2",
|
|
agent=agent
|
|
)
|
|
|
|
crew = Crew(
|
|
agents=[agent],
|
|
tasks=[task]
|
|
)
|
|
|
|
crew._prepare_tools(agent, task, [])
|
|
|
|
mock_code_interpreter_class.assert_called_with(
|
|
unsafe_mode=False,
|
|
default_image_tag="python:3.11-slim"
|
|
)
|