Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /BerriAI_litellm /tests /e2e /batches /conftest.py
| """Batches suite's `client` fixture. | |
| The shared lifecycle (resources/scoped_key), proxy liveness gate, and e2e marker | |
| live in the parent tests/e2e/conftest.py. BatchClient holds the shared ProxyClient, so | |
| the `resources` fixture cleans up keys through it; tests register file deletes and | |
| batch cancels via `resources.defer(...)`. | |
| Batch deployments (openai-batch, azure-batch, vertex-batch, ...) are registered | |
| once per session via /model/new and deleted on teardown so they need not live in | |
| the proxy config. | |
| """ | |
| from __future__ import annotations | |
| import os | |
| from typing import Iterator | |
| import pytest | |
| from batch_client import BatchClient, build_client | |
| from capabilities import PROVIDERS | |
| from e2e_config import MANAGED_FILES_OPT_IN_ENV | |
| from e2e_http import NoBody | |
| from proxy_client import ProxyClient | |
| def pytest_configure(config: pytest.Config) -> None: | |
| config.addinivalue_line( | |
| "markers", | |
| "covers: registry cell a test covers, e.g. llm.batches.openai.basic.nonstream.works", | |
| ) | |
| def pytest_collection_modifyitems( | |
| config: pytest.Config, items: list[pytest.Item] | |
| ) -> None: | |
| if os.environ.get(MANAGED_FILES_OPT_IN_ENV): | |
| return | |
| deselected = [ | |
| item for item in items if item.get_closest_marker("managed_files") is not None | |
| ] | |
| if not deselected: | |
| return | |
| config.hook.pytest_deselected(items=deselected) | |
| items[:] = [ | |
| item for item in items if item.get_closest_marker("managed_files") is None | |
| ] | |
| def client(proxy: ProxyClient) -> BatchClient: | |
| return build_client(proxy) | |
| def batch_deployments(client: BatchClient) -> Iterator[None]: | |
| probe = client.proxy.probe("/health/liveliness", params=NoBody()) | |
| if not probe.healthy: | |
| yield | |
| return | |
| registered: list[str] = [] | |
| try: | |
| for provider in PROVIDERS: | |
| registered.append( | |
| client.create_model(provider.model, provider.litellm_params()) | |
| ) | |
| yield | |
| finally: | |
| for model_id in registered: | |
| client.delete_model(model_id) | |
Xet Storage Details
- Size:
- 2.12 kB
- Xet hash:
- 32ce529822baa2962703398a7ea3b725393c536bfd1206dee3cca8671b87edb1
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.