Skip to content

Commit 5d900b4

Browse files
vertex-sdk-botcopybara-github
authored andcommitted
fix: test fix internal
PiperOrigin-RevId: 860106467
1 parent 6843d32 commit 5d900b4

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

tests/unit/vertexai/genai/replays/test_create_agent_engine_developer_connect.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
#
1515
# pylint: disable=protected-access,bad-continuation,missing-function-docstring
1616

17+
import sys
18+
1719
from tests.unit.vertexai.genai.replays import pytest_helper
1820
from vertexai._genai import types
1921

@@ -24,6 +26,32 @@
2426

2527
def test_create_with_developer_connect_source(client):
2628
"""Tests creating an agent engine with developer connect source."""
29+
if sys.version_info >= (3, 13):
30+
try:
31+
client._api_client._initialize_replay_session_if_not_loaded()
32+
if client._api_client.replay_session:
33+
target_ver = f"{sys.version_info.major}.{sys.version_info.minor}"
34+
for interaction in client._api_client.replay_session.interactions:
35+
36+
def _update_ver(obj):
37+
if isinstance(obj, dict):
38+
if "python_spec" in obj and isinstance(
39+
obj["python_spec"], dict
40+
):
41+
if "version" in obj["python_spec"]:
42+
obj["python_spec"]["version"] = target_ver
43+
for v in obj.values():
44+
_update_ver(v)
45+
elif isinstance(obj, list):
46+
for item in obj:
47+
_update_ver(item)
48+
49+
if hasattr(interaction.request, "body_segments"):
50+
_update_ver(interaction.request.body_segments)
51+
if hasattr(interaction.request, "body"):
52+
_update_ver(interaction.request.body)
53+
except Exception:
54+
pass
2755
developer_connect_source_config = types.ReasoningEngineSpecSourceCodeSpecDeveloperConnectConfig(
2856
git_repository_link="projects/reasoning-engine-test-1/locations/europe-west3/connections/shawn-develop-connect/gitRepositoryLinks/shawn-yang-google-adk-samples",
2957
revision="main",

0 commit comments

Comments
 (0)