fix(tests): add autouse cache-isolation fixture to get_available_models test files

Fixes the CI failure introduced by #817: test_model_resolver::test_custom_endpoint_uses_model_config_api_key_for_model_discovery was failing with KeyError: 'auth' due to the 60s TTL cache in get_available_models() being populated by test_byok_model_dropdown.py tests that ran earlier. Added autouse _isolate_models_cache fixture to 5 test files. Full suite 1747/1747, QA harness green.
This commit is contained in:
nesquena-hermes
2026-04-21 17:41:05 -07:00
committed by GitHub
parent 8f1f582caf
commit 2d8bccdd96
5 changed files with 84 additions and 0 deletions

View File

@@ -6,9 +6,24 @@ env-var fallback detection.
import os
import sys
import types
import pytest
import api.config as config
@pytest.fixture(autouse=True)
def _isolate_models_cache():
"""Invalidate the models TTL cache before and after every test in this file."""
try:
config.invalidate_models_cache()
except Exception:
pass
yield
try:
config.invalidate_models_cache()
except Exception:
pass
# ── Provider registration ─────────────────────────────────────────────
def test_opencode_zen_in_provider_display():