Skip to content

Commit bfb9245

Browse files
committed
test(bulk): route the e2e test's light discovery through call_tool_success
A bare mcp_client.call_tool() for ha_search meant a real tool failure was indistinguishable from "no lights found" -- both landed on the same pytest.skip(), silently hiding an infrastructure problem instead of failing the test. Folds the search into the test's existing MCPAssertions context so call_tool_success raises loudly on an actual error.
1 parent d208856 commit bfb9245

1 file changed

Lines changed: 16 additions & 12 deletions

File tree

tests/src/e2e/workflows/core/test_bulk.py

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -223,22 +223,26 @@ async def test_operations_mode_rejects_real_group_and_member_conflict(
223223
against Home Assistant's real entity_id/member_entity_ids shape, not
224224
just a fixture.
225225
"""
226-
# Discovered dynamically, not hardcoded to specific demo-platform
227-
# entities: mirrors test_bulk_control_multiple_lights' own pattern
228-
# for finding real lights to build a batch from.
229-
search_result = await mcp_client.call_tool(
230-
"ha_search", {"domain_filter": "light", "limit": 5}
231-
)
232-
search_data = parse_mcp_result(search_result)
233-
results = search_data.get("entities", [])
234-
if len(results) < 2:
235-
pytest.skip("Need at least 2 lights to build a real group for this test")
236-
member_entity_ids = [r.get("entity_id") for r in results[:2]]
237-
238226
object_id = f"test_e2e_bulk_conflict_{uuid4().hex[:8]}"
239227
group_entity_id = f"group.{object_id}"
240228

241229
async with MCPAssertions(mcp_client) as mcp:
230+
# Discovered dynamically, not hardcoded to specific demo-platform
231+
# entities: mirrors test_bulk_control_multiple_lights' own
232+
# pattern for finding real lights to build a batch from. Routed
233+
# through call_tool_success (not a bare mcp_client.call_tool) so
234+
# a real ha_search failure fails the test loudly instead of
235+
# being silently read as "no entities" and skipped.
236+
search_data = await mcp.call_tool_success(
237+
"ha_search", {"domain_filter": "light", "limit": 5}
238+
)
239+
results = search_data.get("entities", [])
240+
if len(results) < 2:
241+
pytest.skip(
242+
"Need at least 2 lights to build a real group for this test"
243+
)
244+
member_entity_ids = [r.get("entity_id") for r in results[:2]]
245+
242246
create_data = await mcp.call_tool_success(
243247
"ha_config_set_group",
244248
{

0 commit comments

Comments
 (0)