MCPcopy
hub / github.com/MinishLab/semble / test_index_cache_awaits_model

Function test_index_cache_awaits_model

tests/test_mcp.py:400–411  ·  view source on GitHub ↗

get() blocks until the model is installed, then proceeds.

(tmp_path: Path)

Source from the content-addressed store, hash-verified

398
399@pytest.mark.anyio
400async def test_index_cache_awaits_model(tmp_path: Path) -> None:
401 """get() blocks until the model is installed, then proceeds."""
402 cache = _IndexCache() # no model yet
403 fake_index = MagicMock()
404 with patch("semble.mcp.SembleIndex.from_path", return_value=fake_index):
405 get_task = asyncio.create_task(cache.get(str(tmp_path)))
406 await asyncio.sleep(0.01)
407 assert not get_task.done(), "get() must block until the model is installed"
408 cache._model_path = "/fake/model"
409 cache._model_ready.set()
410 result = await asyncio.wait_for(get_task, timeout=1.0)
411 assert result is fake_index
412
413
414@pytest.mark.anyio

Callers

nothing calls this directly

Calls 2

_IndexCacheClass · 0.90
getMethod · 0.80

Tested by

no test coverage detected