From 35571708ba604413abff8df6849282cbfc596ce7 Mon Sep 17 00:00:00 2001 From: Sameer Kankute Date: Wed, 7 Jan 2026 16:08:54 +0530 Subject: [PATCH] fix:test_encode_decode_helpers_roundtrip_in_cache_context --- .../gitlab/test_gitlab_prompt_manager.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/test_litellm/integrations/gitlab/test_gitlab_prompt_manager.py b/tests/test_litellm/integrations/gitlab/test_gitlab_prompt_manager.py index 8475252cfc2..99cec5df561 100644 --- a/tests/test_litellm/integrations/gitlab/test_gitlab_prompt_manager.py +++ b/tests/test_litellm/integrations/gitlab/test_gitlab_prompt_manager.py @@ -1,18 +1,19 @@ import os import sys from unittest.mock import MagicMock, patch + import pytest sys.path.insert(0, os.path.abspath("../../..")) # Adds the parent directory to the system path from litellm.integrations.gitlab.gitlab_client import GitLabClient from litellm.integrations.gitlab.gitlab_prompt_manager import ( + GitLabPromptCache, GitLabPromptManager, GitLabPromptTemplate, GitLabTemplateManager, - GitLabPromptCache, - encode_prompt_id, decode_prompt_id, + encode_prompt_id, ) # ----------------------- @@ -817,11 +818,16 @@ def test_cache_get_by_file_returns_exact_entry(mock_pm_cls, fake_managers): assert beta and beta["id"] == "nested/beta" +@patch("litellm.integrations.gitlab.gitlab_client.GitLabClient") @patch("litellm.integrations.gitlab.gitlab_prompt_manager.GitLabPromptManager") -def test_encode_decode_helpers_roundtrip_in_cache_context(mock_pm_cls, fake_managers): +def test_encode_decode_helpers_roundtrip_in_cache_context(mock_pm_cls, mock_client_cls, fake_managers): tm, wrapper = fake_managers tm._discoverable_ids = ["dir1/dir2/item"] mock_pm_cls.return_value = wrapper + + # Mock the GitLabClient to avoid real HTTP requests + mock_client = MagicMock() + mock_client_cls.return_value = mock_client cache = GitLabPromptCache({"project": "g/s/r", "access_token": "tkn"}) cache.load_all()