mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-05-03 00:02:36 +00:00
fix: remove stdout prints, improve test determinism, and update trace handling
Removed `print` statements from the `LLMStreamChunkEvent` handler to prevent LLM response chunks from being written directly to stdout. The listener now only tracks chunks internally. Fixes #3715 Added explicit return statements for trace-related tests. Updated cassette for `test_failed_evaluation` to reflect new behavior where an empty trace dict is used instead of returning early. Ensured deterministic cleanup order in test fixtures by making `clear_event_bus_handlers` depend on `setup_test_environment`. This guarantees event bus shutdown and file handle cleanup occur before temporary directory deletion, resolving intermittent “Directory not empty” errors in CI.
This commit is contained in:
@@ -160,11 +160,13 @@ def mock_opentelemetry_components():
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def clear_event_bus_handlers():
|
||||
def clear_event_bus_handlers(setup_test_environment):
|
||||
"""Clear event bus handlers after each test for isolation.
|
||||
|
||||
Handlers registered during the test are allowed to run, then cleaned up
|
||||
after the test completes.
|
||||
|
||||
Depends on setup_test_environment to ensure cleanup happens in correct order.
|
||||
"""
|
||||
from crewai.events.event_bus import crewai_event_bus
|
||||
from crewai.experimental.evaluation.evaluation_listener import (
|
||||
@@ -173,6 +175,7 @@ def clear_event_bus_handlers():
|
||||
|
||||
yield
|
||||
|
||||
# Shutdown event bus and wait for all handlers to complete
|
||||
crewai_event_bus.shutdown(wait=True)
|
||||
crewai_event_bus._initialize()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user