From f4d5ea7917b5baa1ac0c3f0270c82f5ef2771bb7 Mon Sep 17 00:00:00 2001 From: Kanchan-Microsoft Date: Tue, 3 Feb 2026 10:46:56 +0530 Subject: [PATCH] fixed new suggestions --- src/tests/backend/auth/conftest.py | 1 - .../backend/v4/common/services/test_agents_service.py | 4 +--- src/tests/backend/v4/config/test_agent_registry.py | 1 - src/tests/backend/v4/config/test_settings.py | 7 +++---- .../backend/v4/magentic_agents/models/test_agent_models.py | 2 +- .../v4/orchestration/test_human_approval_manager.py | 5 ++--- 6 files changed, 7 insertions(+), 13 deletions(-) diff --git a/src/tests/backend/auth/conftest.py b/src/tests/backend/auth/conftest.py index 3af5b60e4..3f47dc645 100644 --- a/src/tests/backend/auth/conftest.py +++ b/src/tests/backend/auth/conftest.py @@ -5,7 +5,6 @@ import pytest import sys import os -from unittest.mock import MagicMock, patch import base64 import json diff --git a/src/tests/backend/v4/common/services/test_agents_service.py b/src/tests/backend/v4/common/services/test_agents_service.py index 568c6b2f9..1034628dc 100644 --- a/src/tests/backend/v4/common/services/test_agents_service.py +++ b/src/tests/backend/v4/common/services/test_agents_service.py @@ -16,9 +16,7 @@ import asyncio import logging import importlib.util -from unittest.mock import patch, MagicMock, AsyncMock, Mock -from typing import Any, Dict, Optional, List, Union -from dataclasses import dataclass +from unittest.mock import patch, MagicMock # Add the src directory to sys.path for proper import src_path = os.path.join(os.path.dirname(__file__), '..', '..', '..', '..') diff --git a/src/tests/backend/v4/config/test_agent_registry.py b/src/tests/backend/v4/config/test_agent_registry.py index 351d9aec2..e421095c4 100644 --- a/src/tests/backend/v4/config/test_agent_registry.py +++ b/src/tests/backend/v4/config/test_agent_registry.py @@ -5,7 +5,6 @@ including registration, unregistration, cleanup, and monitoring functionality. """ -import asyncio import logging import os import sys diff --git a/src/tests/backend/v4/config/test_settings.py b/src/tests/backend/v4/config/test_settings.py index 3df0f9ebe..1a986482e 100644 --- a/src/tests/backend/v4/config/test_settings.py +++ b/src/tests/backend/v4/config/test_settings.py @@ -8,7 +8,6 @@ import os import sys import unittest -from unittest import IsolatedAsyncioTestCase from unittest.mock import AsyncMock, Mock, patch # Add the backend directory to the Python path @@ -162,7 +161,7 @@ def test_ad_token_provider(self, mock_config): self.assertEqual(token, "test-token-123") mock_credential.get_token.assert_called_once_with(mock_config.AZURE_COGNITIVE_SERVICES) -class TestAzureConfigAsync(IsolatedAsyncioTestCase): +class TestAzureConfigAsync(unittest.IsolatedAsyncioTestCase): """Async test cases for AzureConfig class.""" @patch('backend.v4.config.settings.AzureOpenAIChatClient') @@ -284,7 +283,7 @@ def test_overwrite_existing_team(self): self.assertEqual(config.get_current_team(user_id), team_config2) -class TestOrchestrationConfig(IsolatedAsyncioTestCase): +class TestOrchestrationConfig(unittest.IsolatedAsyncioTestCase): """Test cases for OrchestrationConfig class.""" def test_orchestration_config_creation(self): @@ -490,7 +489,7 @@ def test_cleanup_clarification(self): self.assertNotIn(request_id, config._clarification_events) -class TestConnectionConfig(IsolatedAsyncioTestCase): +class TestConnectionConfig(unittest.IsolatedAsyncioTestCase): """Test cases for ConnectionConfig class.""" def test_connection_config_creation(self): diff --git a/src/tests/backend/v4/magentic_agents/models/test_agent_models.py b/src/tests/backend/v4/magentic_agents/models/test_agent_models.py index 4ab97db0d..a4511b3be 100644 --- a/src/tests/backend/v4/magentic_agents/models/test_agent_models.py +++ b/src/tests/backend/v4/magentic_agents/models/test_agent_models.py @@ -1,6 +1,6 @@ """Unit tests for backend.v4.magentic_agents.models.agent_models module.""" import sys -from unittest.mock import Mock, patch, MagicMock +from unittest.mock import patch, MagicMock import pytest diff --git a/src/tests/backend/v4/orchestration/test_human_approval_manager.py b/src/tests/backend/v4/orchestration/test_human_approval_manager.py index 177efab2b..952cbf166 100644 --- a/src/tests/backend/v4/orchestration/test_human_approval_manager.py +++ b/src/tests/backend/v4/orchestration/test_human_approval_manager.py @@ -7,8 +7,8 @@ import logging import os import sys +import unittest from typing import Any, Optional -from unittest import IsolatedAsyncioTestCase from unittest.mock import Mock, AsyncMock, patch import pytest @@ -225,7 +225,7 @@ def convert(plan_text, facts, team, task): messages = sys.modules['v4.models.messages'] -class TestHumanApprovalMagenticManager(IsolatedAsyncioTestCase): +class TestHumanApprovalMagenticManager(unittest.IsolatedAsyncioTestCase): """Test cases for HumanApprovalMagenticManager class.""" def setUp(self): @@ -697,5 +697,4 @@ async def test_create_progress_ledger_websocket_error(self): if __name__ == '__main__': - import unittest unittest.main() \ No newline at end of file