Fix failing tests

This commit is contained in:
Vinicius Brasil
2025-05-01 18:03:32 -03:00
parent 7f97ace752
commit 4a685b7146
2 changed files with 8 additions and 8 deletions

View File

@@ -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):

View File

@@ -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