Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions tests/integration/test_onnx_models_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@ async def test_enable_without_weights_is_rejected(
) -> None:
"""Enabling a model that was never downloaded must not persist enabled=True."""
client, _server, auth = env
from octop.infra.agents.providers import onnx_service

monkeypatch.setattr(onnx_service, "ensure_local_embedding_deps_async", _ready)
monkeypatch.setattr("octop.api.routers.onnx_models.ensure_local_embedding_deps_async", _ready)

resp = await client.put(
"/api/onnx-models/config",
Expand All @@ -44,7 +43,7 @@ async def test_enable_succeeds_once_weights_are_present(
client, _server, auth = env
from octop.infra.agents.providers import onnx_service

monkeypatch.setattr(onnx_service, "ensure_local_embedding_deps_async", _ready)
monkeypatch.setattr("octop.api.routers.onnx_models.ensure_local_embedding_deps_async", _ready)
monkeypatch.setattr(onnx_service, "local_embedding_deps_available", lambda: True)
_seed_cache(tmp_octop_home, MODEL)

Expand All @@ -67,7 +66,7 @@ async def test_activate_reports_downloaded_nested_weights(
client, _server, auth = env
from octop.infra.agents.providers import onnx_service

monkeypatch.setattr(onnx_service, "ensure_local_embedding_deps_async", _ready)
monkeypatch.setattr("octop.api.routers.onnx_models.ensure_local_embedding_deps_async", _ready)
monkeypatch.setattr(onnx_service, "local_embedding_deps_available", lambda: True)

model = "jinaai/jina-clip-v1"
Expand Down Expand Up @@ -105,7 +104,7 @@ async def test_knowledge_onnx_test_uses_knowledge_settings_permission(
client, _server, admin_auth = env
from octop.infra.agents.providers import onnx_service

monkeypatch.setattr(onnx_service, "ensure_local_embedding_deps_async", _ready)
monkeypatch.setattr("octop.api.routers.onnx_models.ensure_local_embedding_deps_async", _ready)
monkeypatch.setattr(onnx_service, "local_embedding_deps_available", lambda: True)
monkeypatch.setattr(onnx_service, "embed_texts", lambda _m, _t: [[0.0] * 512])
_seed_cache(tmp_octop_home, MODEL)
Expand Down Expand Up @@ -134,9 +133,8 @@ async def test_knowledge_onnx_test_reports_missing_weights(
) -> None:
"""A model with no weights yields a local message, never a remote error."""
client, _server, auth = env
from octop.infra.agents.providers import onnx_service

monkeypatch.setattr(onnx_service, "ensure_local_embedding_deps_async", _ready)
monkeypatch.setattr("octop.api.routers.onnx_models.ensure_local_embedding_deps_async", _ready)

resp = await client.post("/api/knowledge-bases/onnx-test", headers=auth, json={"model": MODEL})
assert resp.status_code == 200, resp.text
Expand Down
18 changes: 12 additions & 6 deletions tests/unit/agents/test_skills_hub_raw.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,12 @@ def _fake_http_text_get(url: str, params: dict | None = None) -> str:
return FIND_SKILLS_MD
raise AssertionError(f"unexpected raw fetch: {url}")

with patch(
"octop.infra.skills.skills_hub._http_text_get",
side_effect=_fake_http_text_get,
with (
patch("octop.infra.skills.skills_hub._http_text_get", side_effect=_fake_http_text_get),
patch(
"octop.infra.skills.skills_hub._http_bytes_get",
side_effect=HTTPError("https://codeload.github.com", 404, "Not Found", None, None),
),
):
resolved = resolve_bundle_from_url(
bundle_url="https://skills.sh/vercel-labs/skills/find-skills",
Expand Down Expand Up @@ -69,9 +72,12 @@ def _fake_http_text_get(url: str, params: dict | None = None) -> str:
return FIND_SKILLS_MD
raise AssertionError(f"unexpected raw fetch: {url}")

with patch(
"octop.infra.skills.skills_hub._http_text_get",
side_effect=_fake_http_text_get,
with (
patch("octop.infra.skills.skills_hub._http_text_get", side_effect=_fake_http_text_get),
patch(
"octop.infra.skills.skills_hub._http_bytes_get",
side_effect=HTTPError("https://codeload.github.com", 404, "Not Found", None, None),
),
):
resolved = resolve_bundle_from_url(
bundle_url="https://skills.sh/vercel-labs/skills/find-skills",
Expand Down
5 changes: 5 additions & 0 deletions tests/unit/api/test_knowledge_bases.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ async def test_enabling_without_model_maps_prerequisite_error(
) -> None:
from octop.api.routers import knowledge_bases

async def ready(**_kwargs: object) -> str:
return "ready"

monkeypatch.setattr(knowledge_bases, "ensure_local_embedding_deps_async", ready)

server = SimpleNamespace(services=_services())

def fail(*_args: object, **_kwargs: object) -> None:
Expand Down
Loading