From 4a685b71461c5f1d7bca93b3169f4a7586e922d8 Mon Sep 17 00:00:00 2001 From: Vinicius Brasil Date: Thu, 1 May 2025 18:03:32 -0300 Subject: [PATCH] Fix failing tests --- tests/crew_test.py | 4 ++-- tests/test_lite_agent.py | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/crew_test.py b/tests/crew_test.py index 6ca67cfd9..a4e4e61df 100644 --- a/tests/crew_test.py +++ b/tests/crew_test.py @@ -4353,7 +4353,7 @@ def test_crew_copy_with_memory(): pytest.fail(f"Copying crew raised an unexpected exception: {e}") -def test_sets_parent_flow_when_outside_flow(): +def test_sets_parent_flow_when_outside_flow(researcher, writer): crew = Crew( agents=[researcher, writer], process=Process.sequential, @@ -4365,7 +4365,7 @@ def test_sets_parent_flow_when_outside_flow(): assert crew.parent_flow is None -def test_sets_parent_flow_when_inside_flow(): +def test_sets_parent_flow_when_inside_flow(researcher, writer): class MyFlow(Flow): @start() def start(self): diff --git a/tests/test_lite_agent.py b/tests/test_lite_agent.py index 74986f740..7ef23dccb 100644 --- a/tests/test_lite_agent.py +++ b/tests/test_lite_agent.py @@ -290,11 +290,6 @@ def verify_agent_parent_flow(result, agent, flow): def test_sets_parent_flow_when_inside_flow(): captured_agent = None - @crewai_event_bus.on(LiteAgentExecutionStartedEvent) - def capture_agent(source, event): - nonlocal captured_agent - captured_agent = source - mock_llm = Mock(spec=LLM) mock_llm.call.return_value = "Test response" @@ -312,6 +307,11 @@ def test_sets_parent_flow_when_inside_flow(): flow = MyFlow() with crewai_event_bus.scoped_handlers(): + + @crewai_event_bus.on(LiteAgentExecutionStartedEvent) + def capture_agent(source, event): + nonlocal captured_agent + captured_agent = source + result = flow.kickoff() - assert result.parent_flow is flow assert captured_agent.parent_flow is flow