|
1 | 1 | """Unit tests for functions defined in src/client.py.""" |
2 | 2 |
|
3 | | -import os |
4 | 3 | import pytest |
5 | | -from unittest.mock import patch |
6 | 4 |
|
7 | 5 | from client import get_llama_stack_client |
8 | 6 | from models.config import LLamaStackConfiguration |
9 | 7 |
|
10 | 8 |
|
11 | 9 | # [tisnik] Need to resolve dependencies on CI to be able to run this tests |
12 | | -@patch.dict(os.environ, {"INFERENCE_MODEL": "llama3.2:3b-instruct-fp16"}) |
13 | | -def _test_get_llama_stack_library_client() -> None: |
| 10 | +def test_get_llama_stack_library_client() -> None: |
14 | 11 | cfg = LLamaStackConfiguration( |
15 | 12 | url=None, |
16 | 13 | api_key=None, |
17 | 14 | use_as_library_client=True, |
18 | | - library_client_config_path="ollama", |
| 15 | + library_client_config_path="./tests/configuration/minimal-stack.yaml", |
19 | 16 | ) |
| 17 | + |
20 | 18 | client = get_llama_stack_client(cfg) |
21 | 19 | assert client is not None |
22 | 20 |
|
23 | 21 |
|
24 | | -@patch.dict(os.environ, {"INFERENCE_MODEL": "llama3.2:3b-instruct-fp16"}) |
25 | 22 | def test_get_llama_stack_remote_client() -> None: |
26 | 23 | cfg = LLamaStackConfiguration( |
27 | 24 | url="http://localhost:8321", |
28 | 25 | api_key=None, |
29 | 26 | use_as_library_client=False, |
30 | | - library_client_config_path="ollama", |
| 27 | + library_client_config_path="./tests/configuration/minimal-stack.yaml", |
31 | 28 | ) |
32 | 29 | client = get_llama_stack_client(cfg) |
33 | 30 | assert client is not None |
34 | 31 |
|
35 | 32 |
|
36 | | -@patch.dict(os.environ, {"INFERENCE_MODEL": "llama3.2:3b-instruct-fp16"}) |
37 | 33 | def test_get_llama_stack_wrong_configuration() -> None: |
38 | 34 | cfg = LLamaStackConfiguration( |
39 | 35 | url=None, |
40 | 36 | api_key=None, |
41 | 37 | use_as_library_client=True, |
42 | | - library_client_config_path="ollama", |
| 38 | + library_client_config_path="./tests/configuration/minimal-stack.yaml", |
43 | 39 | ) |
44 | 40 | cfg.library_client_config_path = None |
45 | 41 | with pytest.raises( |
|
0 commit comments