55
66import asyncio
77import json
8- import os
9- import sys
10- import unittest
11- from unittest import IsolatedAsyncioTestCase
8+ from unittest import TestCase , IsolatedAsyncioTestCase , main
129from unittest .mock import AsyncMock , Mock , patch
1310
1411# Environment variables are set by conftest.py
2320)
2421
2522
26- class TestAzureConfig (unittest . TestCase ):
23+ class TestAzureConfig (TestCase ):
2724 """Test cases for AzureConfig class."""
2825
2926 @patch ('backend.v4.config.settings.config' )
@@ -76,7 +73,7 @@ def test_ad_token_provider(self, mock_config):
7673 mock_credential .get_token .assert_called_once_with (mock_config .AZURE_COGNITIVE_SERVICES )
7774
7875
79- class TestAzureConfigAsync (unittest . IsolatedAsyncioTestCase ):
76+ class TestAzureConfigAsync (IsolatedAsyncioTestCase ):
8077 """Async test cases for AzureConfig class."""
8178
8279 @patch ('backend.v4.config.settings.AzureOpenAIChatClient' )
@@ -106,7 +103,7 @@ async def test_create_chat_completion_service_reasoning_model(self, mock_client_
106103 mock_client_class .assert_called_once ()
107104
108105
109- class TestMCPConfig (unittest . TestCase ):
106+ class TestMCPConfig (TestCase ):
110107 """Test cases for MCPConfig class."""
111108
112109 def test_mcp_config_creation (self ):
@@ -151,7 +148,7 @@ def test_get_headers_with_none_token(self):
151148 self .assertEqual (headers , {})
152149
153150
154- class TestTeamConfig (unittest . TestCase ):
151+ class TestTeamConfig (TestCase ):
155152 """Test cases for TeamConfig class."""
156153
157154 def test_team_config_creation (self ):
@@ -198,7 +195,7 @@ def test_overwrite_existing_team(self):
198195 self .assertEqual (config .get_current_team (user_id ), team_config2 )
199196
200197
201- class TestOrchestrationConfig (unittest . IsolatedAsyncioTestCase ):
198+ class TestOrchestrationConfig (IsolatedAsyncioTestCase ):
202199 """Test cases for OrchestrationConfig class."""
203200
204201 def test_orchestration_config_creation (self ):
@@ -347,9 +344,10 @@ async def cancel_task():
347344 cancel_task_handle = asyncio .create_task (cancel_task ())
348345
349346 with self .assertRaises (asyncio .CancelledError ):
350- await task
347+ _ = await task
351348
352349 await cancel_task_handle
350+ self .assertTrue (cancel_task_handle .done ())
353351
354352 async def test_wait_for_clarification_cancelled (self ):
355353 """Test waiting for clarification when cancelled."""
@@ -367,9 +365,10 @@ async def cancel_task():
367365 cancel_task_handle = asyncio .create_task (cancel_task ())
368366
369367 with self .assertRaises (asyncio .CancelledError ):
370- await task
368+ _ = await task
371369
372370 await cancel_task_handle
371+ self .assertTrue (cancel_task_handle .done ())
373372
374373 def test_cleanup_approval (self ):
375374 """Test cleanup approval."""
@@ -404,7 +403,7 @@ def test_cleanup_clarification(self):
404403 self .assertNotIn (request_id , config ._clarification_events )
405404
406405
407- class TestConnectionConfig (unittest . IsolatedAsyncioTestCase ):
406+ class TestConnectionConfig (IsolatedAsyncioTestCase ):
408407 """Test cases for ConnectionConfig class."""
409408
410409 def test_connection_config_creation (self ):
@@ -745,7 +744,7 @@ def test_send_status_update_sync_no_connection(self):
745744 mock_logger .warning .assert_called ()
746745
747746
748- class TestGlobalInstances (unittest . TestCase ):
747+ class TestGlobalInstances (TestCase ):
749748 """Test cases for global configuration instances."""
750749
751750 def test_global_instances_exist (self ):
@@ -873,4 +872,4 @@ async def approve_task():
873872
874873
875874if __name__ == '__main__' :
876- unittest . main ()
875+ main ()
0 commit comments