mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-07-01 13:18:10 +00:00
fix: address PR #5788 review comments
- Remove dead `env_vars.get("MODEL")` check in _setup_env (always truthy
since MODEL is set two lines above)
- Fix test_sync_delegation mock: use return_value instead of side_effect
list and disable planning to prevent StopAsyncIteration on Python 3.10
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -776,7 +776,7 @@ def _setup_env(base: Path, llm_model: str) -> None:
|
||||
for details in ENV_VARS.get(provider, [])
|
||||
if "key_name" in details
|
||||
)
|
||||
if already_set and env_vars.get("MODEL"):
|
||||
if already_set:
|
||||
return
|
||||
|
||||
if provider in ENV_VARS:
|
||||
|
||||
@@ -377,12 +377,13 @@ class TestDelegation:
|
||||
@patch("crewai.new_agent.executor.aget_llm_response")
|
||||
@pytest.mark.asyncio
|
||||
async def test_sync_delegation(self, mock_llm_response):
|
||||
mock_llm_response.side_effect = [
|
||||
"Draft article about AI.", # writer's response
|
||||
"Here is the summary based on the writer's output.", # manager's response
|
||||
]
|
||||
mock_llm_response.return_value = "Draft article about AI."
|
||||
|
||||
writer = NewAgent(role="Writer", goal="Write articles")
|
||||
writer = NewAgent(
|
||||
role="Writer",
|
||||
goal="Write articles",
|
||||
settings={"planning_enabled": False},
|
||||
)
|
||||
tool = DelegateToCoworkerTool(coworker=writer)
|
||||
|
||||
result = tool._run(message="Write an article about AI")
|
||||
|
||||
Reference in New Issue
Block a user