Skip to content

Commit bbe29ce

Browse files
committed
revert langchain
1 parent d5662c2 commit bbe29ce

1 file changed

Lines changed: 5 additions & 16 deletions

File tree

integrations/langchain/tests/unit_tests/test_genie.py

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
from unittest.mock import MagicMock, patch
1+
from unittest.mock import patch
22

33
import pytest
44
from databricks.sdk.service.dashboards import GenieSpace
55
from databricks_ai_bridge.genie import Genie, GenieResponse
66
from langchain_core.messages import AIMessage
7-
from mcp.types import CallToolResult
87

98
from databricks_langchain.genie import (
109
GenieAgent,
@@ -13,16 +12,6 @@
1312
)
1413

1514

16-
@pytest.fixture(autouse=True)
17-
def mock_databricks_oauth_provider():
18-
"""Auto-mock DatabricksOAuthClientProvider for all tests to avoid OAuth validation errors."""
19-
with patch("databricks_mcp.mcp.DatabricksOAuthClientProvider") as mock_auth:
20-
# Return a MagicMock instance that won't try to get OAuth tokens
21-
mock_auth_instance = MagicMock()
22-
mock_auth.return_value = mock_auth_instance
23-
yield mock_auth
24-
25-
2615
def test_concat_messages_array():
2716
# Test a simple case with multiple messages
2817
messages = [
@@ -74,8 +63,8 @@ def test_query_genie_as_agent(MockWorkspaceClient):
7463
input_data = {"messages": [{"role": "user", "content": "What is the weather?"}]}
7564
genie = Genie("space-id", MockWorkspaceClient)
7665

77-
# Mock the ask_question method at the module level to avoid mlflow tracing issues
78-
with patch("databricks_ai_bridge.genie.Genie.ask_question", return_value=mock_genie_response):
66+
# Mock the ask_question method to return our mock response
67+
with patch.object(genie, "ask_question", return_value=mock_genie_response):
7968
# Test with include_context=False (default)
8069
result = _query_genie_as_agent(input_data, genie, "Genie")
8170
expected_message = {
@@ -152,8 +141,8 @@ def test_query_genie_with_client(mock_workspace_client):
152141
input_data = {"messages": [{"role": "user", "content": "What is the weather?"}]}
153142
genie = Genie("space-id", mock_workspace_client)
154143

155-
# Mock the ask_question method at the module level to avoid mlflow tracing issues
156-
with patch("databricks_ai_bridge.genie.Genie.ask_question", return_value=mock_genie_response):
144+
# Mock the ask_question method to return our mock response
145+
with patch.object(genie, "ask_question", return_value=mock_genie_response):
157146
result = _query_genie_as_agent(input_data, genie, "Genie")
158147
expected_message = {
159148
"messages": [AIMessage(content="It is sunny.", name="query_result")],

0 commit comments

Comments
 (0)