Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

test: address review notes on the chronic-test repairs

Yuneng Jianga5a78670d047
diff --git a/tests/rust-python-harness/shared/native_build.py b/tests/rust-python-harness/shared/native_build.py
index 7df0f999847..8693cf3bac2 100644
--- a/tests/rust-python-harness/shared/native_build.py
+++ b/tests/rust-python-harness/shared/native_build.py
@@ -74,7 +74,6 @@ def _rebuild(repo_root: Path) -> tuple[bool, str]:
def trace_bridge_error() -> str | None:
- """Why the installed bridge cannot serve trace parity, or None when it can. Never rebuilds."""
bridge: Final = get_native_bridge()
if bridge is None:
return "native Rust bridge is not importable"
diff --git a/tests/test_models.py b/tests/test_models.py
index 186752af2bc..64c7dcd83da 100644
--- a/tests/test_models.py
+++ b/tests/test_models.py
@@ -6,6 +6,7 @@ import asyncio
import aiohttp
import os
import dotenv
+from typing import Final
from dotenv import load_dotenv
load_dotenv()
@@ -487,9 +488,6 @@ async def test_get_personal_models_for_user():
async def test_model_group_info_e2e():
"""
Test /model/group/info endpoint
-
- The proxy config declares a wildcard "anthropic/*" deployment, and the endpoint resolves
- wildcards into the concrete models they cover, so the raw pattern is never returned.
"""
async with aiohttp.ClientSession() as session:
models = await get_models(session=session, key="sk-1234")
@@ -498,7 +496,7 @@ async def test_model_group_info_e2e():
model_group_info = await get_model_group_info(session=session, key="sk-1234")
print(model_group_info)
- model_groups = [m["model_group"] for m in model_group_info["data"]]
+ model_groups: Final = [m["model_group"] for m in model_group_info["data"]]
assert "anthropic/*" not in model_groups, (
f"Expected 'anthropic/*' to be expanded, but it was returned verbatim: {model_groups}"
diff --git a/tests/test_rust_python_harness.py b/tests/test_rust_python_harness.py
index 179660dd4e9..85b45c07bc2 100644
--- a/tests/test_rust_python_harness.py
+++ b/tests/test_rust_python_harness.py
@@ -124,7 +124,7 @@ def test_should_leave_functions_without_mapping_contracts_unimplemented() -> Non
def test_should_report_a_bridge_that_cannot_be_imported() -> None:
with pytest.MonkeyPatch.context() as patch:
patch.setattr(native_build, "get_native_bridge", lambda: None)
- message = native_build.trace_bridge_error()
+ message: Final = native_build.trace_bridge_error()
assert message is not None
assert "not importable" in message
@@ -133,7 +133,7 @@ def test_should_report_a_bridge_that_cannot_be_imported() -> None:
def test_should_report_a_bridge_built_without_the_trace_feature() -> None:
with pytest.MonkeyPatch.context() as patch:
patch.setattr(native_build, "get_native_bridge", lambda: SimpleNamespace(_trace=None))
- message = native_build.trace_bridge_error()
+ message: Final = native_build.trace_bridge_error()
assert message is not None
assert native_build.BRIDGE_FEATURE in message
@@ -147,18 +147,14 @@ def test_should_accept_a_bridge_built_with_the_trace_feature() -> None:
def test_should_not_rebuild_the_bridge_while_reporting_its_state() -> None:
- rebuilds: list[object] = []
-
- def fake_rebuild(repo_root: object) -> tuple[bool, str]:
- rebuilds.append(repo_root)
- return True, ""
+ def forbidden_rebuild(repo_root: object) -> tuple[bool, str]:
+ raise AssertionError("trace_bridge_error must not rebuild the native bridge")
with pytest.MonkeyPatch.context() as patch:
- patch.setattr(native_build, "_rebuild", fake_rebuild)
+ patch.setattr(native_build, "_rebuild", forbidden_rebuild)
patch.setattr(native_build, "get_native_bridge", lambda: None)
- native_build.trace_bridge_error()
- assert rebuilds == []
+ assert native_build.trace_bridge_error() is not None
def test_should_derive_ocr_mapping_status_from_live_tests() -> None: