File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change 1313os .environ ["COSMOSDB_DATABASE" ] = "mock_database"
1414os .environ ["COSMOSDB_CONTAINER" ] = "mock_container"
1515
16-
17- @pytest .mark .asyncio
16+ # Test cases with loop_scope="session" for async functions
17+ @pytest .mark .asyncio ( loop_scope = "session" )
1818@patch ("src.backend.utils.SingleThreadedAgentRuntime" )
1919@patch ("src.backend.utils.CosmosBufferedChatCompletionContext" )
2020@patch ("src.backend.utils.ToolAgent.register" )
@@ -34,7 +34,7 @@ async def test_initialize_runtime_and_context_new_session(
3434 assert len (runtime_dict ) > 0
3535
3636
37- @pytest .mark .asyncio
37+ @pytest .mark .asyncio ( loop_scope = "session" )
3838@patch ("src.backend.utils.SingleThreadedAgentRuntime" )
3939@patch ("src.backend.utils.CosmosBufferedChatCompletionContext" )
4040@patch ("src.backend.utils.ToolAgent.register" )
@@ -54,6 +54,7 @@ async def test_initialize_runtime_and_context_reuse_existing_session(
5454 assert context == mock_context_instance
5555
5656
57+ # Regular (non-async) test case
5758@patch ("src.backend.utils.requests.post" )
5859@patch ("src.backend.utils.DefaultAzureCredential" )
5960def test_rai_success_true (mock_credential , mock_post ):
You can’t perform that action at this time.
0 commit comments