From 09ed9bd2d601e50b9ec40bfffd8f211e88275ef2 Mon Sep 17 00:00:00 2001 From: Yujong Lee Date: Tue, 15 Sep 2026 04:18:57 +0000 Subject: [PATCH] test(rust): cover the OCR kill switch through the catalog and use a raw regex Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- tests/test_litellm/rust_bridge/test_catalog.py | 8 ++++++++ tests/test_litellm/rust_bridge/test_route.py | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/test_litellm/rust_bridge/test_catalog.py b/tests/test_litellm/rust_bridge/test_catalog.py index 95595790d34..313a504833b 100644 --- a/tests/test_litellm/rust_bridge/test_catalog.py +++ b/tests/test_litellm/rust_bridge/test_catalog.py @@ -97,3 +97,11 @@ def test_bedrock_transcription_ignores_the_optional_rust_switch() -> None: configuration.rust(False) assert COMPONENTS[ComponentName.TRANSCRIPTION].resolve(context).decision is ExecutionDecision.RUST_REQUIRED + + +def test_ocr_matches_the_legacy_gate_under_the_environment_kill_switch(monkeypatch: pytest.MonkeyPatch) -> None: + monkeypatch.setenv("LITELLM_RUST", "0") + configuration.rust(True) + + assert configuration.rust_ocr_enabled() is False + assert COMPONENTS[ComponentName.OCR].resolve().decision is ExecutionDecision.PYTHON diff --git a/tests/test_litellm/rust_bridge/test_route.py b/tests/test_litellm/rust_bridge/test_route.py index 2831e7dfcc4..5a6cbf14bd8 100644 --- a/tests/test_litellm/rust_bridge/test_route.py +++ b/tests/test_litellm/rust_bridge/test_route.py @@ -114,5 +114,5 @@ def test_bind_only_allows_declared_exports(monkeypatch: pytest.MonkeyPatch) -> N component: Final = NativeComponent(name=ComponentName.TOKEN_COUNTER, capability=OPT_IN, exports=("route",)) assert component.bind("route", validate=lambda value: value if isinstance(value, int) else None).load() == 3 - with pytest.raises(ValueError, match="'other'.*token_counter"): + with pytest.raises(ValueError, match=r"'other'.*token_counter"): component.bind("other", validate=lambda value: value)