-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathconftest.py
More file actions
55 lines (44 loc) · 1.32 KB
/
conftest.py
File metadata and controls
55 lines (44 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
"""Pytest configuration and fixtures for api tests."""
from typing import Any
import pytest
from pytest_mock import MockerFixture
from lightspeed_evaluation.core.models import APIConfig
@pytest.fixture
def basic_api_config_query_endpoint() -> APIConfig:
"""Create test API config for query endpoint."""
return APIConfig(
enabled=True,
api_base="http://localhost:8080",
version="v1",
endpoint_type="query",
timeout=30,
cache_enabled=False,
)
@pytest.fixture
def basic_api_config_streaming_endpoint() -> APIConfig:
"""Create basic API configuration for streaming endpoint."""
return APIConfig(
enabled=True,
api_base="http://localhost:8080",
endpoint_type="streaming",
timeout=30,
provider="openai",
model="gpt-4",
cache_enabled=False,
)
@pytest.fixture
def basic_api_config_infer_endpoint() -> APIConfig:
"""Create test API config for infer endpoint."""
return APIConfig(
enabled=True,
api_base="http://localhost:8080",
version="v1",
endpoint_type="infer",
timeout=30,
cache_enabled=False,
)
@pytest.fixture
def mock_response(mocker: MockerFixture) -> Any:
"""Create a mock streaming response."""
response = mocker.Mock()
return response