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:
Devin AI
2025-08-02 16:10:35 +00:00
parent ea560d0af1
commit f133d13a00
5 changed files with 5 additions and 14 deletions

View File

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

View File

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

View File

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

View File

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

View File

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