mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-10 08:38:30 +00:00
Update crew test to validate verbose output and kickoff_for_each method
- Enhance test_crew_verbose_output to check specific listener log messages - Modify test_kickoff_for_each_invalid_input to use Pydantic validation error - Improve test coverage for crew logging and input validation
This commit is contained in:
@@ -850,8 +850,21 @@ def test_crew_verbose_output(capsys):
|
|||||||
crew.verbose = False
|
crew.verbose = False
|
||||||
crew._logger = Logger(verbose=False)
|
crew._logger = Logger(verbose=False)
|
||||||
crew.kickoff()
|
crew.kickoff()
|
||||||
|
expected_listener_logs = [
|
||||||
|
"[🚀 CREW 'CREW' STARTED]",
|
||||||
|
"[📋 TASK STARTED: RESEARCH AI ADVANCEMENTS.]",
|
||||||
|
"[🤖 AGENT 'RESEARCHER' STARTED TASK]",
|
||||||
|
"[👍 AGENT 'RESEARCHER' COMPLETED TASK]",
|
||||||
|
"[📋 TASK COMPLETED: RESEARCH AI ADVANCEMENTS.]",
|
||||||
|
"[📋 TASK STARTED: WRITE ABOUT AI IN HEALTHCARE.]",
|
||||||
|
"[🤖 AGENT 'SENIOR WRITER' STARTED TASK]",
|
||||||
|
"[👍 AGENT 'SENIOR WRITER' COMPLETED TASK]",
|
||||||
|
"[📋 TASK COMPLETED: WRITE ABOUT AI IN HEALTHCARE.]",
|
||||||
|
"[✅ CREW 'CREW' COMPLETED]"
|
||||||
|
]
|
||||||
captured = capsys.readouterr()
|
captured = capsys.readouterr()
|
||||||
assert captured.out == ""
|
for log in expected_listener_logs:
|
||||||
|
assert log in captured.out
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.vcr(filter_headers=["authorization"])
|
@pytest.mark.vcr(filter_headers=["authorization"])
|
||||||
@@ -1289,9 +1302,9 @@ def test_kickoff_for_each_invalid_input():
|
|||||||
|
|
||||||
crew = Crew(agents=[agent], tasks=[task])
|
crew = Crew(agents=[agent], tasks=[task])
|
||||||
|
|
||||||
with pytest.raises(TypeError):
|
with pytest.raises(pydantic_core._pydantic_core.ValidationError):
|
||||||
# Pass a string instead of a list
|
# Pass a string instead of a list
|
||||||
crew.kickoff_for_each("invalid input")
|
crew.kickoff_for_each(["invalid input"])
|
||||||
|
|
||||||
|
|
||||||
def test_kickoff_for_each_error_handling():
|
def test_kickoff_for_each_error_handling():
|
||||||
|
|||||||
Reference in New Issue
Block a user