66from models .config import LlamaStackConfiguration
77
88
9+ def test_client_get_client_method () -> None :
10+ """Test how get_client method works for unitialized client."""
11+
12+ client = LlamaStackClientHolder ()
13+
14+ with pytest .raises (
15+ RuntimeError ,
16+ match = "LlamaStackClient has not been initialised. Ensure 'load\\ (..\\ )' has been called." ,
17+ ):
18+ client .get_client ()
19+
20+
21+ def test_async_client_get_client_method () -> None :
22+ """Test how get_client method works for unitialized client."""
23+ client = AsyncLlamaStackClientHolder ()
24+
25+ with pytest .raises (
26+ RuntimeError ,
27+ match = (
28+ "AsyncLlamaStackClient has not been initialised. "
29+ "Ensure 'load\\ (..\\ )' has been called."
30+ ),
31+ ):
32+ client .get_client ()
33+
34+
935def test_get_llama_stack_library_client () -> None :
1036 """Test if Llama Stack can be initialized in library client mode."""
1137 cfg = LlamaStackConfiguration (
@@ -18,6 +44,9 @@ def test_get_llama_stack_library_client() -> None:
1844 client .load (cfg )
1945 assert client is not None
2046
47+ ls_client = client .get_client ()
48+ assert ls_client is not None
49+
2150
2251def test_get_llama_stack_remote_client () -> None :
2352 """Test if Llama Stack can be initialized in remove client (server) mode."""
@@ -31,6 +60,9 @@ def test_get_llama_stack_remote_client() -> None:
3160 client .load (cfg )
3261 assert client is not None
3362
63+ ls_client = client .get_client ()
64+ assert ls_client is not None
65+
3466
3567def test_get_llama_stack_wrong_configuration () -> None :
3668 """Test if configuration is checked before Llama Stack is initialized."""
@@ -61,6 +93,9 @@ async def test_get_async_llama_stack_library_client() -> None:
6193 await client .load (cfg )
6294 assert client is not None
6395
96+ ls_client = client .get_client ()
97+ assert ls_client is not None
98+
6499
65100async def test_get_async_llama_stack_remote_client () -> None :
66101 """Test the initialization of asynchronous Llama Stack client in server mode."""
@@ -74,6 +109,9 @@ async def test_get_async_llama_stack_remote_client() -> None:
74109 await client .load (cfg )
75110 assert client is not None
76111
112+ ls_client = client .get_client ()
113+ assert ls_client is not None
114+
77115
78116async def test_get_async_llama_stack_wrong_configuration () -> None :
79117 """Test if configuration is checked before Llama Stack is initialized."""
0 commit comments