Co-authored-by: Clément Sirieix <clement.sirieix@mistral.ai>
Co-authored-by: Guillaume LE GOFF <guillaume.lgf@gmail.com>
Co-authored-by: Hdandria <henri.dandria@mistral.ai>
Co-authored-by: Ivana Dunisijevic <ivana.dunisijevic@mistral.ai>
Co-authored-by: Jean Burellier <sheplu@users.noreply.github.com>
Co-authored-by: Mathias Gesbert <mathias.gesbert@mistral.ai>
Co-authored-by: Mert Unsal <mert.unsal@mistral.ai>
Co-authored-by: Michel Thomazo <51709227+michelTho@users.noreply.github.com>
Co-authored-by: Paul VEZIA <166131032+le-codeur-rapide@users.noreply.github.com>
Co-authored-by: Pierre Rossinès <pierre.rossines@mistral.ai>
Co-authored-by: Val <102326092+vdeva@users.noreply.github.com>
Co-authored-by: Vincent G <10739306+VinceOPS@users.noreply.github.com>
Co-authored-by: renovate-mistral[bot] <253709520+renovate-mistral[bot]@users.noreply.github.com>
Co-authored-by: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
Clément Drouin 2026-06-19 11:01:24 +02:00 committed by GitHub
parent 564a14365e
commit 6bedf271ce
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
223 changed files with 10533 additions and 6947 deletions

View file

@ -5,6 +5,9 @@ from pathlib import Path
import sys
from typing import Any
import keyring
from keyring.backend import KeyringBackend
import keyring.errors
import pytest
import tomli_w
@ -34,6 +37,39 @@ from vibe.core.config.harness_files import (
from vibe.core.llm.types import BackendLike
class _EmptyKeyring(KeyringBackend):
"""A keyring backend that stores nothing, used to keep tests off the real OS keyring."""
priority = 1 # type: ignore[assignment]
def get_password(self, service: str, username: str) -> str | None:
return None
def set_password(self, service: str, username: str, password: str) -> None:
return None
def delete_password(self, service: str, username: str) -> None:
raise keyring.errors.PasswordDeleteError(username)
@pytest.fixture(autouse=True)
def _disable_os_keyring() -> Generator[None, None, None]:
"""Keep the suite off the real OS keyring.
``resolve_api_key`` and ``VibeConfig._check_api_key`` now consult the keyring, so
without this every config construction would touch the real Keychain. We install an
empty backend (rather than patching ``keyring.get_password``) so tests that swap in
their own backend via ``keyring.set_keyring`` still work. Tests that exercise keyring
behaviour opt in by patching ``keyring.get_password`` / ``set_password`` directly.
"""
original = keyring.get_keyring()
keyring.set_keyring(_EmptyKeyring())
try:
yield
finally:
keyring.set_keyring(original)
def get_base_config() -> dict[str, Any]:
return {
"active_model": "devstral-latest",
@ -143,6 +179,8 @@ def _scratchpad_dir(
@pytest.fixture(autouse=True)
def _mock_api_key(monkeypatch: pytest.MonkeyPatch) -> None:
monkeypatch.setenv("MISTRAL_API_KEY", "mock")
monkeypatch.setenv("ANTHROPIC_API_KEY", "mock")
monkeypatch.setenv("OPENAI_API_KEY", "mock")
@pytest.fixture(autouse=True)
@ -262,6 +300,9 @@ def build_test_vibe_config(**kwargs) -> VibeConfig:
)
if kwargs.get("models"):
kwargs.setdefault("active_model", kwargs["models"][0].alias)
# Connectors trigger a real HTTP discovery on agent construction; off by
# default so tests don't pay for it. Connector tests pass enable_connectors=True.
kwargs.setdefault("enable_connectors", False)
return VibeConfig(
session_logging=resolved_session_logging,
enable_update_checks=resolved_enable_update_checks,