diff --git a/tests/components/profiler/test_init.py b/tests/components/profiler/test_init.py index 37940df437b..84314b7b22c 100644 --- a/tests/components/profiler/test_init.py +++ b/tests/components/profiler/test_init.py @@ -211,9 +211,10 @@ async def test_dump_log_object( assert hass.services.has_service(DOMAIN, SERVICE_DUMP_LOG_OBJECTS) - await hass.services.async_call( - DOMAIN, SERVICE_DUMP_LOG_OBJECTS, {CONF_TYPE: "DumpLogDummy"}, blocking=True - ) + with patch("objgraph.by_type", return_value=[obj1, obj2]): + await hass.services.async_call( + DOMAIN, SERVICE_DUMP_LOG_OBJECTS, {CONF_TYPE: "DumpLogDummy"}, blocking=True + ) assert "" in caplog.text assert "Failed to serialize" in caplog.text