Skip to content

Commit 0d63cb7

Browse files
emontnemeryepenetCopilot
authored
Fix lg_netcast tests opening sockets (home-assistant#156459)
Co-authored-by: epenet <[email protected]> Co-authored-by: Copilot <[email protected]>
1 parent 3cb4145 commit 0d63cb7

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

tests/components/lg_netcast/test_device_trigger.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
"""The tests for LG NEtcast device triggers."""
1+
"""The tests for LG Netcast device triggers."""
2+
3+
from collections.abc import Generator
4+
from unittest.mock import patch
25

36
import pytest
47

@@ -19,6 +22,13 @@
1922
from tests.common import MockConfigEntry, async_get_device_automations
2023

2124

25+
@pytest.fixture(autouse=True)
26+
def mock_lg_netcast() -> Generator[None]:
27+
"""Mock LG Netcast library."""
28+
with patch("homeassistant.components.lg_netcast.LgNetCastClient"):
29+
yield
30+
31+
2232
async def test_get_triggers(
2333
hass: HomeAssistant, device_registry: dr.DeviceRegistry
2434
) -> None:

tests/components/lg_netcast/test_trigger.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""The tests for LG Netcast device triggers."""
22

3+
from collections.abc import Generator
34
from unittest.mock import patch
45

56
import pytest
@@ -17,6 +18,13 @@
1718
from tests.common import MockEntity, MockEntityPlatform
1819

1920

21+
@pytest.fixture(autouse=True)
22+
def mock_lg_netcast() -> Generator[None]:
23+
"""Mock LG Netcast library."""
24+
with patch("homeassistant.components.lg_netcast.LgNetCastClient"):
25+
yield
26+
27+
2028
async def test_lg_netcast_turn_on_trigger_device_id(
2129
hass: HomeAssistant,
2230
service_calls: list[ServiceCall],

0 commit comments

Comments
 (0)