@@ -46,6 +46,9 @@ def test_get_llama_stack_library_client() -> None:
4646
4747 ls_client = client .get_client ()
4848 assert ls_client is not None
49+ assert not ls_client .is_closed ()
50+ ls_client .close ()
51+ assert ls_client .is_closed ()
4952
5053
5154def test_get_llama_stack_remote_client () -> None :
@@ -62,6 +65,9 @@ def test_get_llama_stack_remote_client() -> None:
6265
6366 ls_client = client .get_client ()
6467 assert ls_client is not None
68+ assert not ls_client .is_closed ()
69+ ls_client .close ()
70+ assert ls_client .is_closed ()
6571
6672
6773def test_get_llama_stack_wrong_configuration () -> None :
@@ -81,6 +87,8 @@ def test_get_llama_stack_wrong_configuration() -> None:
8187 client .load (cfg )
8288
8389
90+
91+ @pytest .mark .asyncio
8492async def test_get_async_llama_stack_library_client () -> None :
8593 """Test the initialization of asynchronous Llama Stack client in library mode."""
8694 cfg = LlamaStackConfiguration (
@@ -93,8 +101,12 @@ async def test_get_async_llama_stack_library_client() -> None:
93101 await client .load (cfg )
94102 assert client is not None
95103
96- ls_client = client .get_client ()
97- assert ls_client is not None
104+ async with client .get_client () as ls_client :
105+ assert ls_client is not None
106+ assert not ls_client .is_closed ()
107+ await ls_client .close ()
108+ assert ls_client .is_closed ()
109+
98110
99111
100112async def test_get_async_llama_stack_remote_client () -> None :
0 commit comments