mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-23 15:18:14 +00:00
fix: resolve lint issues in human input event streaming implementation
- Remove unused imports from server modules and test files - Fix undefined variable references in test assertions - All ruff checks now pass locally Co-Authored-By: João <joao@crewai.com>
This commit is contained in:
@@ -2,7 +2,6 @@ import asyncio
|
|||||||
import json
|
import json
|
||||||
import uuid
|
import uuid
|
||||||
from typing import Dict, List, Optional, Set
|
from typing import Dict, List, Optional, Set
|
||||||
from datetime import datetime, timezone
|
|
||||||
|
|
||||||
from crewai.utilities.events.crewai_event_bus import crewai_event_bus
|
from crewai.utilities.events.crewai_event_bus import crewai_event_bus
|
||||||
from crewai.utilities.events.task_events import HumanInputRequiredEvent, HumanInputCompletedEvent
|
from crewai.utilities.events.task_events import HumanInputRequiredEvent, HumanInputCompletedEvent
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
import json
|
import json
|
||||||
import queue
|
from typing import Optional
|
||||||
import uuid
|
|
||||||
from typing import Optional, Dict, Any
|
|
||||||
from datetime import datetime, timezone
|
from datetime import datetime, timezone
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -1,10 +1,7 @@
|
|||||||
import pytest
|
|
||||||
import asyncio
|
|
||||||
import json
|
|
||||||
from unittest.mock import MagicMock, patch
|
from unittest.mock import MagicMock, patch
|
||||||
|
|
||||||
from crewai.server.event_stream_manager import EventStreamManager
|
from crewai.server.event_stream_manager import EventStreamManager
|
||||||
from crewai.utilities.events.task_events import HumanInputRequiredEvent, HumanInputCompletedEvent
|
from crewai.utilities.events.task_events import HumanInputRequiredEvent
|
||||||
|
|
||||||
|
|
||||||
class TestEventStreamManager:
|
class TestEventStreamManager:
|
||||||
|
|||||||
@@ -1,7 +1,4 @@
|
|||||||
import pytest
|
import pytest
|
||||||
import asyncio
|
|
||||||
import json
|
|
||||||
from unittest.mock import patch, MagicMock
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from fastapi.testclient import TestClient
|
from fastapi.testclient import TestClient
|
||||||
|
|||||||
@@ -167,7 +167,7 @@ class TestHumanInputEventIntegration:
|
|||||||
with patch.object(crewai_event_bus, 'emit', side_effect=capture_event), \
|
with patch.object(crewai_event_bus, 'emit', side_effect=capture_event), \
|
||||||
patch('builtins.input', return_value='test'):
|
patch('builtins.input', return_value='test'):
|
||||||
|
|
||||||
result = self.executor._ask_human_input("Test result")
|
self.executor._ask_human_input("Test result")
|
||||||
|
|
||||||
assert len(events_captured) == 2
|
assert len(events_captured) == 2
|
||||||
required_event = events_captured[0][1]
|
required_event = events_captured[0][1]
|
||||||
@@ -185,7 +185,7 @@ class TestHumanInputEventIntegration:
|
|||||||
with patch.object(crewai_event_bus, 'emit', side_effect=capture_event), \
|
with patch.object(crewai_event_bus, 'emit', side_effect=capture_event), \
|
||||||
patch('builtins.input', return_value='test'):
|
patch('builtins.input', return_value='test'):
|
||||||
|
|
||||||
result = self.executor._ask_human_input("Test result")
|
self.executor._ask_human_input("Test result")
|
||||||
|
|
||||||
assert len(events_captured) == 2
|
assert len(events_captured) == 2
|
||||||
required_event = events_captured[0][1]
|
required_event = events_captured[0][1]
|
||||||
@@ -202,7 +202,7 @@ class TestHumanInputEventIntegration:
|
|||||||
with patch.object(crewai_event_bus, 'emit', side_effect=capture_event), \
|
with patch.object(crewai_event_bus, 'emit', side_effect=capture_event), \
|
||||||
patch('builtins.input', return_value='test'):
|
patch('builtins.input', return_value='test'):
|
||||||
|
|
||||||
result = self.executor._ask_human_input("Test result")
|
self.executor._ask_human_input("Test result")
|
||||||
|
|
||||||
assert len(events_captured) == 2
|
assert len(events_captured) == 2
|
||||||
required_event = events_captured[0][1]
|
required_event = events_captured[0][1]
|
||||||
|
|||||||
Reference in New Issue
Block a user