mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 04:07:08 +00:00
Fix incorrect return types in samsungtv tests (#143937)
This commit is contained in:
parent
8fafbfaf82
commit
e24082be9a
@ -53,7 +53,7 @@ def silent_ssdp_scanner() -> Generator[None]:
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def samsungtv_mock_async_get_local_ip():
|
||||
def samsungtv_mock_async_get_local_ip() -> Generator[None]:
|
||||
"""Mock upnp util's async_get_local_ip."""
|
||||
with patch(
|
||||
"homeassistant.components.samsungtv.media_player.async_get_local_ip",
|
||||
@ -63,7 +63,7 @@ def samsungtv_mock_async_get_local_ip():
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def fake_host_fixture() -> None:
|
||||
def fake_host_fixture() -> Generator[None]:
|
||||
"""Patch gethostbyname."""
|
||||
with patch(
|
||||
"homeassistant.components.samsungtv.config_flow.socket.gethostbyname",
|
||||
@ -73,14 +73,14 @@ def fake_host_fixture() -> None:
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def app_list_delay_fixture() -> None:
|
||||
def app_list_delay_fixture() -> Generator[None]:
|
||||
"""Patch APP_LIST_DELAY."""
|
||||
with patch("homeassistant.components.samsungtv.media_player.APP_LIST_DELAY", 0):
|
||||
yield
|
||||
|
||||
|
||||
@pytest.fixture(name="upnp_factory", autouse=True)
|
||||
def upnp_factory_fixture() -> Mock:
|
||||
def upnp_factory_fixture() -> Generator[Mock]:
|
||||
"""Patch UpnpFactory."""
|
||||
with patch(
|
||||
"homeassistant.components.samsungtv.media_player.UpnpFactory",
|
||||
@ -92,7 +92,7 @@ def upnp_factory_fixture() -> Mock:
|
||||
|
||||
|
||||
@pytest.fixture(name="upnp_device")
|
||||
async def upnp_device_fixture(upnp_factory: Mock) -> Mock:
|
||||
def upnp_device_fixture(upnp_factory: Mock) -> Generator[Mock]:
|
||||
"""Patch async_upnp_client."""
|
||||
upnp_device = Mock(UpnpDevice)
|
||||
upnp_device.services = {}
|
||||
@ -102,7 +102,7 @@ async def upnp_device_fixture(upnp_factory: Mock) -> Mock:
|
||||
|
||||
|
||||
@pytest.fixture(name="dmr_device")
|
||||
async def dmr_device_fixture(upnp_device: Mock) -> Mock:
|
||||
def dmr_device_fixture(upnp_device: Mock) -> Generator[Mock]:
|
||||
"""Patch async_upnp_client."""
|
||||
with patch(
|
||||
"homeassistant.components.samsungtv.media_player.DmrDevice",
|
||||
@ -137,7 +137,7 @@ async def dmr_device_fixture(upnp_device: Mock) -> Mock:
|
||||
|
||||
|
||||
@pytest.fixture(name="upnp_notify_server")
|
||||
async def upnp_notify_server_fixture(upnp_factory: Mock) -> Mock:
|
||||
def upnp_notify_server_fixture(upnp_factory: Mock) -> Generator[Mock]:
|
||||
"""Patch async_upnp_client."""
|
||||
with patch(
|
||||
"homeassistant.components.samsungtv.media_player.AiohttpNotifyServer",
|
||||
@ -149,7 +149,7 @@ async def upnp_notify_server_fixture(upnp_factory: Mock) -> Mock:
|
||||
|
||||
|
||||
@pytest.fixture(name="remote")
|
||||
def remote_fixture() -> Mock:
|
||||
def remote_fixture() -> Generator[Mock]:
|
||||
"""Patch the samsungctl Remote."""
|
||||
with patch("homeassistant.components.samsungtv.bridge.Remote") as remote_class:
|
||||
remote = Mock(Remote)
|
||||
@ -160,7 +160,7 @@ def remote_fixture() -> Mock:
|
||||
|
||||
|
||||
@pytest.fixture(name="rest_api")
|
||||
def rest_api_fixture() -> Mock:
|
||||
def rest_api_fixture() -> Generator[Mock]:
|
||||
"""Patch the samsungtvws SamsungTVAsyncRest."""
|
||||
with patch(
|
||||
"homeassistant.components.samsungtv.bridge.SamsungTVAsyncRest",
|
||||
@ -173,7 +173,7 @@ def rest_api_fixture() -> Mock:
|
||||
|
||||
|
||||
@pytest.fixture(name="rest_api_non_ssl_only")
|
||||
def rest_api_fixture_non_ssl_only() -> Mock:
|
||||
def rest_api_fixture_non_ssl_only() -> Generator[None]:
|
||||
"""Patch the samsungtvws SamsungTVAsyncRest non-ssl only."""
|
||||
|
||||
class MockSamsungTVAsyncRest:
|
||||
@ -198,7 +198,7 @@ def rest_api_fixture_non_ssl_only() -> Mock:
|
||||
|
||||
|
||||
@pytest.fixture(name="rest_api_failing")
|
||||
def rest_api_failure_fixture() -> Mock:
|
||||
def rest_api_failure_fixture() -> Generator[None]:
|
||||
"""Patch the samsungtvws SamsungTVAsyncRest."""
|
||||
with patch(
|
||||
"homeassistant.components.samsungtv.bridge.SamsungTVAsyncRest",
|
||||
@ -209,7 +209,7 @@ def rest_api_failure_fixture() -> Mock:
|
||||
|
||||
|
||||
@pytest.fixture(name="remoteencws_failing")
|
||||
def remoteencws_failing_fixture():
|
||||
def remoteencws_failing_fixture() -> Generator[None]:
|
||||
"""Patch the samsungtvws SamsungTVEncryptedWSAsyncRemote."""
|
||||
with patch(
|
||||
"homeassistant.components.samsungtv.bridge.SamsungTVEncryptedWSAsyncRemote.start_listening",
|
||||
@ -219,7 +219,7 @@ def remoteencws_failing_fixture():
|
||||
|
||||
|
||||
@pytest.fixture(name="remotews")
|
||||
def remotews_fixture() -> Mock:
|
||||
def remotews_fixture() -> Generator[Mock]:
|
||||
"""Patch the samsungtvws SamsungTVWS."""
|
||||
remotews = Mock(SamsungTVWSAsyncRemote)
|
||||
remotews.__aenter__ = AsyncMock(return_value=remotews)
|
||||
@ -260,7 +260,7 @@ def remotews_fixture() -> Mock:
|
||||
|
||||
|
||||
@pytest.fixture(name="remoteencws")
|
||||
def remoteencws_fixture() -> Mock:
|
||||
def remoteencws_fixture() -> Generator[Mock]:
|
||||
"""Patch the samsungtvws SamsungTVEncryptedWSAsyncRemote."""
|
||||
remoteencws = Mock(SamsungTVEncryptedWSAsyncRemote)
|
||||
remoteencws.__aenter__ = AsyncMock(return_value=remoteencws)
|
||||
@ -292,7 +292,7 @@ def mock_now() -> datetime:
|
||||
|
||||
|
||||
@pytest.fixture(name="mac_address", autouse=True)
|
||||
def mac_address_fixture() -> Mock:
|
||||
def mac_address_fixture() -> Generator[Mock]:
|
||||
"""Patch getmac.get_mac_address."""
|
||||
with patch("getmac.get_mac_address", return_value=None) as mac:
|
||||
yield mac
|
||||
|
Loading…
x
Reference in New Issue
Block a user