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]

tests(llm_translation): add pytest-recording to license allowlist + greptile fixes

Cursor Agent0e880dc83628
diff --git a/tests/code_coverage_tests/liccheck.ini b/tests/code_coverage_tests/liccheck.ini
index 4ecc0d0bc98..344e38da835 100644
--- a/tests/code_coverage_tests/liccheck.ini
+++ b/tests/code_coverage_tests/liccheck.ini
@@ -169,3 +169,4 @@ langchain-mcp-adapters: >=0.2.1 # MIT License
langgraph: >=1.0.10 # MIT License
langgraph-prebuilt: >=1.0.8 # MIT License - https://github.com/langchain-ai/langgraph/blob/main/LICENSE
pytest-rerunfailures: >=15.1 # MPL 2.0 license
+pytest-recording: >=0.13.4 # MIT license
diff --git a/tests/llm_translation/cassettes/_record_anthropic_fixtures.py b/tests/llm_translation/cassettes/_record_anthropic_fixtures.py
index 91472fbbd1e..81321b992e1 100644
--- a/tests/llm_translation/cassettes/_record_anthropic_fixtures.py
+++ b/tests/llm_translation/cassettes/_record_anthropic_fixtures.py
@@ -30,7 +30,6 @@ from __future__ import annotations
import json
import os
-import re
import sys
import threading
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
@@ -38,6 +37,7 @@ from pathlib import Path
from typing import Any, Iterable
import vcr # type: ignore[import-not-found]
+import yaml # type: ignore[import-not-found]
REPO_ROOT = Path(__file__).resolve().parents[3]
sys.path.insert(0, str(REPO_ROOT))
@@ -173,21 +173,18 @@ _NON_DETERMINISTIC_HEADERS = ("Date", "Server")
def _strip_nondeterministic_headers(path: Path) -> None:
- """Remove headers whose values change every run from the cassette."""
- text = path.read_text()
- for header in _NON_DETERMINISTIC_HEADERS:
- # Matches a YAML block like::
- #
- # Date:
- # - Thu, 30 Apr 2026 00:43:16 GMT
- #
- # under the response ``headers:`` mapping. Indentation is fixed by vcrpy.
- pattern = re.compile(
- rf"^ {re.escape(header)}:\n - .*\n",
- re.MULTILINE,
- )
- text = pattern.sub("", text)
- path.write_text(text)
+ """Remove headers whose values change every run from the cassette.
+
+ Parses + rewrites the YAML rather than regex-substituting against a
+ fixed indentation, so this stays correct if vcrpy ever changes its
+ serialization style.
+ """
+ cassette = yaml.safe_load(path.read_text())
+ for interaction in cassette.get("interactions") or []:
+ headers = (interaction.get("response") or {}).get("headers") or {}
+ for header in _NON_DETERMINISTIC_HEADERS:
+ headers.pop(header, None)
+ path.write_text(yaml.safe_dump(cassette, default_flow_style=False, sort_keys=False))
def _rewrite_cassette_to_real_host(path: Path, mock_host_port: str) -> None:
diff --git a/tests/llm_translation/conftest.py b/tests/llm_translation/conftest.py
index 831e62d67ec..d944c9046c0 100644
--- a/tests/llm_translation/conftest.py
+++ b/tests/llm_translation/conftest.py
@@ -38,6 +38,9 @@ _FILTERED_REQUEST_HEADERS = (
"authorization",
"x-api-key",
"anthropic-api-key",
+ # Strip ``anthropic-version`` so live-recorded and mock-recorded cassettes
+ # have the same shape (the local mock helper drops it too).
+ "anthropic-version",
"openai-api-key",
"azure-api-key",
"api-key",