opencode-config/tests/test_embedder_live.py
Sergey 25cf10baa6
feat(memory): incremental index with SHA256 + atomic + versioning + flock (#83)
* feat(memory): add SHA256 incremental index with atomic writes, versioning, flock

* feat(memory): parse Retry-After header and add batch progress logging

* test(memory): add incremental, atomic, versioning, retry, batch tests

* docs(memory): update .env.example with OpenRouter defaults

* docs(handoff): add handoff and ADR-036 for incremental index

* docs(handoff): set PR number

* docs(project-map): update index.py and embedder.py descriptions for PR#83

* fix(ci): skip index rewrite on no-op + versioning first-run

* fix(ci): ruff format index.py

---------

Co-authored-by: opencode-agent <agent@opencode.local>
2026-07-26 19:19:55 +03:00

28 lines
831 B
Python

import os
import pytest
os.environ.setdefault("OPENAI_BASE_URL", "http://test/v1")
from src.memory.embedder import embed_texts
@pytest.mark.skipif(not os.environ.get("RUN_LIVE"), reason="needs RUN_LIVE=1")
def test_live_embed_single() -> None:
r = embed_texts(["hello world"])
assert len(r) == 1
assert len(r[0]) > 100
@pytest.mark.skipif(not os.environ.get("RUN_LIVE"), reason="needs RUN_LIVE=1")
def test_live_embed_batch() -> None:
r = embed_texts(["text one", "text two", "text three"])
assert len(r) == 3
assert all(len(emb) > 100 for emb in r)
@pytest.mark.skipif(not os.environ.get("RUN_LIVE"), reason="needs RUN_LIVE=1")
def test_live_embed_qwen3_batch() -> None:
r = embed_texts([f"text {i}" for i in range(100)])
assert len(r) == 100
assert all(len(emb) == 4096 for emb in r)