mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-04 07:27:51 +00:00
* test(e2e): drive the real Codex CLI through the gateway and add the command round trip row Adds tests/e2e/codex: a harness that runs codex exec --json with a throwaway HOME and CODEX_HOME, a custom responses provider pointed at the gateway, the model list read from the gateway's /v1/models, the sandbox on and approvals off. Each test registers its setup's deployment via /model/new and calls it with a key scoped to it, both deleted on teardown. The first row checks that a value only a command can print comes back through the gateway on all five setups * test(e2e): type the Codex self-test event helper as a Mapping * test(e2e): clean up Codex test keys even when setup fails, and fail runs where Codex exits with an error * test(e2e): record a step when the Codex harness sets up its home and workspace The suite rules ask every public harness helper that does something to record a step, so a failed run shows whether it died while setting up Codex or while running it * Update run.py wip
42 lines
1.3 KiB
Python
42 lines
1.3 KiB
Python
from __future__ import annotations
|
|
|
|
from collections.abc import Iterator
|
|
from dataclasses import dataclass
|
|
from typing import Final
|
|
|
|
import pytest
|
|
from cli_harness.rate_limiter import get_default_limiter
|
|
from codex.harness import CodexHarness, codex_harness
|
|
from codex.setups import Deployment, ModelSetup
|
|
from e2e_config import PROXY_BASE_URL, unique_marker
|
|
from lifecycle import ResourceManager
|
|
from proxy_client import ProxyClient
|
|
|
|
|
|
@dataclass(frozen=True, slots=True)
|
|
class _Client:
|
|
proxy: ProxyClient
|
|
|
|
|
|
@pytest.fixture(scope="session")
|
|
def client(proxy: ProxyClient) -> _Client:
|
|
return _Client(proxy)
|
|
|
|
|
|
@pytest.fixture
|
|
def setup(deployment: Deployment, proxy: ProxyClient, resources: ResourceManager) -> ModelSetup:
|
|
model: Final = f"e2e-codex-{unique_marker()}"
|
|
model_id: Final = proxy.create_model(model, deployment.litellm_params, provider_live=True)
|
|
resources.defer(lambda: proxy.delete_model(model_id))
|
|
return ModelSetup(model=model, rate_bucket=deployment.rate_bucket)
|
|
|
|
|
|
@pytest.fixture
|
|
def codex(setup: ModelSetup, resources: ResourceManager) -> Iterator[CodexHarness]:
|
|
with codex_harness(
|
|
gateway=PROXY_BASE_URL,
|
|
api_key=resources.key(models=[setup.model], user_id=None),
|
|
rate_bucket=setup.rate_bucket,
|
|
limiter=get_default_limiter(),
|
|
) as harness:
|
|
yield harness
|