Skip to content

Commit 6dc655c

Browse files
authored
Allow opening sockets in logbook tests (#155840)
1 parent 9f595a9 commit 6dc655c

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

tests/components/logbook/test_init.py

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,14 @@
6060

6161

6262
@pytest.fixture
63-
async def hass_(recorder_mock: Recorder, hass: HomeAssistant) -> HomeAssistant:
63+
async def hass_(
64+
recorder_mock: Recorder,
65+
hass: HomeAssistant,
66+
socket_enabled: None, # Needed because logbook depends on the HTTP integration
67+
) -> HomeAssistant:
6468
"""Set up things to be run when tests are started."""
6569
assert await async_setup_component(hass, logbook.DOMAIN, EMPTY_CONFIG)
70+
await hass.async_block_till_done()
6671
return hass
6772

6873

@@ -125,7 +130,10 @@ async def test_service_call_create_logbook_entry(hass_: HomeAssistant) -> None:
125130
assert last_call.data.get(logbook.ATTR_DOMAIN) == "logbook"
126131

127132

128-
@pytest.mark.usefixtures("recorder_mock")
133+
@pytest.mark.usefixtures(
134+
"recorder_mock",
135+
"socket_enabled", # Needed because logbook depends on the HTTP integration
136+
)
129137
async def test_service_call_create_logbook_entry_invalid_entity_id(
130138
hass: HomeAssistant,
131139
) -> None:
@@ -2966,7 +2974,10 @@ async def test_get_events_with_context_state(
29662974
assert "context_event_type" not in results[3]
29672975

29682976

2969-
@pytest.mark.usefixtures("recorder_mock")
2977+
@pytest.mark.usefixtures(
2978+
"recorder_mock",
2979+
"socket_enabled", # Needed because logbook depends on the HTTP integration
2980+
)
29702981
async def test_logbook_with_empty_config(hass: HomeAssistant) -> None:
29712982
"""Test we handle a empty configuration."""
29722983
assert await async_setup_component(
@@ -2980,7 +2991,10 @@ async def test_logbook_with_empty_config(hass: HomeAssistant) -> None:
29802991
await hass.async_block_till_done()
29812992

29822993

2983-
@pytest.mark.usefixtures("recorder_mock")
2994+
@pytest.mark.usefixtures(
2995+
"recorder_mock",
2996+
"socket_enabled", # Needed because logbook depends on the HTTP integration
2997+
)
29842998
async def test_logbook_with_non_iterable_entity_filter(hass: HomeAssistant) -> None:
29852999
"""Test we handle a non-iterable entity filter."""
29863000
assert await async_setup_component(

0 commit comments

Comments
 (0)