Skip to content

Commit f7bd5fb

Browse files
Testcases
1 parent f59954e commit f7bd5fb

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/backend/tests/test_utils.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
os.environ["COSMOSDB_DATABASE"] = "mock_database"
1414
os.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")
5960
def test_rai_success_true(mock_credential, mock_post):

0 commit comments

Comments
 (0)