# Copyright (c) Microsoft. All rights reserved. from typing import Any from agent_framework import ChatMessage from pytest import fixture # region: Connector Settings fixtures @fixture def exclude_list(request: Any) -> list[str]: """Fixture that returns a list of environment variables to exclude.""" return request.param if hasattr(request, "param") else [] @fixture def override_env_param_dict(request: Any) -> dict[str, str]: """Fixture that returns a dict of environment variables to override.""" return request.param if hasattr(request, "param") else {} # These two fixtures are used for multiple things, also non-connector tests @fixture() def ollama_unit_test_env(monkeypatch, exclude_list, override_env_param_dict): # type: ignore """Fixture to set environment variables for OllamaSettings.""" if exclude_list is None: exclude_list = [] if override_env_param_dict is None: override_env_param_dict = {} env_vars = {"OLLAMA_HOST": "http://localhost:12345", "OLLAMA_MODEL_ID": "test"} env_vars.update(override_env_param_dict) # type: ignore for key, value in env_vars.items(): if key in exclude_list: monkeypatch.delenv(key, raising=False) # type: ignore continue monkeypatch.setenv(key, value) # type: ignore return env_vars @fixture def chat_history() -> list[ChatMessage]: return []