mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-14 23:21:35 +00:00
test(rust): stabilize CI harnesses
This commit is contained in:
parent
ec09ba29d8
commit
7beafeebd8
3 changed files with 11 additions and 3 deletions
5
Makefile
5
Makefile
|
|
@ -319,11 +319,12 @@ test-rust-ocr:
|
|||
[ "$$#" -eq 1 ] || exit 1; \
|
||||
wheel="$$1"; \
|
||||
fi && \
|
||||
UV_PROJECT_ENVIRONMENT="$$temporary/venv" $(UV) sync --python 3.12 --frozen --no-install-project --no-default-groups --group dev --extra proxy && \
|
||||
UV_PROJECT_ENVIRONMENT="$$temporary/venv" $(UV) sync --python 3.12 --frozen --no-install-project --all-groups --all-extras && \
|
||||
$(UV) pip install --python "$$temporary/venv/bin/python" --no-deps "$$wheel" && \
|
||||
LITELLM_LOCAL_MODEL_COST_MAP=True "$$temporary/venv/bin/python" -I -c 'from litellm.rust_bridge import _native; assert callable(_native.ocr) and callable(_native.aocr)' && \
|
||||
LITELLM_REQUIRE_NATIVE_OCR=1 LITELLM_LOCAL_MODEL_COST_MAP=True \
|
||||
"$$temporary/venv/bin/python" -I -m pytest --import-mode=importlib tests/test_litellm/ocr/test_rust_bridge.py -v
|
||||
"$$temporary/venv/bin/python" -I -m pytest --import-mode=importlib \
|
||||
tests/test_litellm_rust/test_ocr.py tests/test_litellm_rust/test_ocr_callbacks.py -v
|
||||
|
||||
test-rust-python: install-rust-python-test-deps
|
||||
@python=$$($(UV_RUN) python -c 'import sys; print(sys.executable)') && \
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import json
|
||||
import asyncio
|
||||
import copy
|
||||
import json
|
||||
import threading
|
||||
import time
|
||||
from collections.abc import Iterator
|
||||
|
|
@ -44,6 +45,11 @@ class RecordingServer:
|
|||
def enqueue(self, response: ResponseSpec) -> None:
|
||||
self.responses.append(response)
|
||||
|
||||
async def wait_for_requests(self, count: int) -> None:
|
||||
async with asyncio.timeout(2):
|
||||
while len(self.requests) < count:
|
||||
await asyncio.sleep(0.01)
|
||||
|
||||
|
||||
@contextmanager
|
||||
def recording_service() -> Iterator[RecordingServer]:
|
||||
|
|
|
|||
|
|
@ -129,6 +129,7 @@ async def test_generic_guardrail_logging_only_verdict_is_exported_over_http(
|
|||
response: Final = await route.invoke(provider, callbacks=[guardrail, logger, recorder])
|
||||
await recorder.wait_for_async("async_log_success_event")
|
||||
await drain_logging()
|
||||
await provider.wait_for_requests(3)
|
||||
|
||||
scan: Final = provider.requests[1]
|
||||
assert scan.path == "/beta/litellm_basic_guardrail_api"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue