get() blocks until the model is installed, then proceeds.
(tmp_path: Path)
| 398 | |
| 399 | @pytest.mark.anyio |
| 400 | async 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 |
nothing calls this directly
no test coverage detected