Files
kite/backend/tests/test_lmstudio.py
T
curo1305 87a32b7ee8 feat(phase-4): complete UX redesign — FileManagerView, FolderTreeItem, test suite, and all Phase 4 fixes
Adds the unified file manager view (Windows Explorer-style), collapsible
folder tree sidebar item, full vitest test suite (55 tests, 4 files), and
commits all Phase 4 backend/frontend fixes that were staged but uncommitted.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-28 17:10:52 +02:00

47 lines
1.5 KiB
Python

"""
Integration test against a live LM Studio instance.
Skipped automatically if LM Studio is not reachable.
"""
import pytest
import httpx
def lmstudio_available() -> bool:
try:
r = httpx.get("http://host.docker.internal:1234/v1/models", timeout=3)
return r.status_code == 200
except Exception:
return False
@pytest.mark.skipif(not lmstudio_available(), reason="LM Studio not reachable at host.docker.internal:1234")
@pytest.mark.asyncio
async def test_lmstudio_health_check():
from ai.lmstudio_provider import LMStudioProvider
provider = LMStudioProvider(
base_url="http://host.docker.internal:1234",
model="gemma-4-e4b-it",
)
ok = await provider.health_check()
assert ok, "LM Studio health check failed"
@pytest.mark.skipif(not lmstudio_available(), reason="LM Studio not reachable at host.docker.internal:1234")
@pytest.mark.asyncio
async def test_lmstudio_classify():
from ai.lmstudio_provider import LMStudioProvider
from services.classifier import _DEFAULT_SYSTEM_PROMPT
provider = LMStudioProvider(
base_url="http://host.docker.internal:1234",
model="gemma-4-e4b-it",
)
result = await provider.classify(
document_text="This document is an invoice for software development services.",
existing_topics=["Finance", "Legal", "HR"],
system_prompt=_DEFAULT_SYSTEM_PROMPT,
)
# Result should have some topics assigned or suggested
assert isinstance(result.topics, list)
assert isinstance(result.suggested_new_topics, list)