Skip to content

Commit a679e97

Browse files
authored
test: fix GitHub test (#2119)
* test: fix GitHub test * try/except block * simplify
1 parent 4734dc2 commit a679e97

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

integrations/github/tests/test_file_editor_tool.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -141,13 +141,15 @@ def test_pipeline_serialization(self, monkeypatch):
141141

142142
pipeline_dict = pipeline.to_dict()
143143

144-
# Remove http_client_kwargs from both dictionaries if it exists
145-
# We don't want to test the http_client_kwargs because Haystack 2.12.0 doesn't have it
146-
# Only Haystack 2.13.0+ has it
147-
if "components" in pipeline_dict:
148-
agent_params = pipeline_dict["components"]["agent"]["init_parameters"]["chat_generator"]["init_parameters"]
149-
if "http_client_kwargs" in agent_params:
150-
del agent_params["http_client_kwargs"]
144+
# Remove parameters introduced after haystack-ai==2.12.0 (the minimum supported version)
145+
# to maintain compatibility
146+
try:
147+
pipeline_dict["components"]["agent"]["init_parameters"]["chat_generator"]["init_parameters"].pop(
148+
"http_client_kwargs", None
149+
)
150+
pipeline_dict["components"]["agent"]["init_parameters"].pop("tool_invoker_kwargs", None)
151+
except KeyError:
152+
pass
151153

152154
expected_dict = {
153155
"metadata": {},

0 commit comments

Comments
 (0)