mirror of
https://github.com/home-assistant/core.git
synced 2025-07-20 11:47:06 +00:00
Improve type hints for silent_ssdp_scanner in tests (#121309)
This commit is contained in:
parent
bf8cef3337
commit
45ab9cae1a
@ -36,7 +36,7 @@ def mock_setup_entry() -> Generator[AsyncMock]:
|
|||||||
|
|
||||||
|
|
||||||
@pytest.fixture(autouse=True)
|
@pytest.fixture(autouse=True)
|
||||||
async def silent_ssdp_scanner(hass):
|
def silent_ssdp_scanner() -> Generator[None]:
|
||||||
"""Start SSDP component and get Scanner, prevent actual SSDP traffic."""
|
"""Start SSDP component and get Scanner, prevent actual SSDP traffic."""
|
||||||
with (
|
with (
|
||||||
patch("homeassistant.components.ssdp.Scanner._async_start_ssdp_listeners"),
|
patch("homeassistant.components.ssdp.Scanner._async_start_ssdp_listeners"),
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
"""Configuration for Sonos tests."""
|
"""Configuration for Sonos tests."""
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
from collections.abc import Callable
|
from collections.abc import Callable, Generator
|
||||||
from copy import copy
|
from copy import copy
|
||||||
from ipaddress import ip_address
|
from ipaddress import ip_address
|
||||||
from unittest.mock import AsyncMock, MagicMock, Mock, patch
|
from unittest.mock import AsyncMock, MagicMock, Mock, patch
|
||||||
@ -271,7 +271,7 @@ def soco_fixture(soco_factory):
|
|||||||
|
|
||||||
|
|
||||||
@pytest.fixture(autouse=True)
|
@pytest.fixture(autouse=True)
|
||||||
async def silent_ssdp_scanner(hass):
|
def silent_ssdp_scanner() -> Generator[None]:
|
||||||
"""Start SSDP component and get Scanner, prevent actual SSDP traffic."""
|
"""Start SSDP component and get Scanner, prevent actual SSDP traffic."""
|
||||||
with (
|
with (
|
||||||
patch("homeassistant.components.ssdp.Scanner._async_start_ssdp_listeners"),
|
patch("homeassistant.components.ssdp.Scanner._async_start_ssdp_listeners"),
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from collections.abc import Generator
|
||||||
import copy
|
import copy
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import socket
|
import socket
|
||||||
@ -153,7 +154,7 @@ def mock_setup_entry():
|
|||||||
|
|
||||||
|
|
||||||
@pytest.fixture(autouse=True)
|
@pytest.fixture(autouse=True)
|
||||||
async def silent_ssdp_scanner(hass):
|
def silent_ssdp_scanner() -> Generator[None]:
|
||||||
"""Start SSDP component and get Scanner, prevent actual SSDP traffic."""
|
"""Start SSDP component and get Scanner, prevent actual SSDP traffic."""
|
||||||
with (
|
with (
|
||||||
patch("homeassistant.components.ssdp.Scanner._async_start_ssdp_listeners"),
|
patch("homeassistant.components.ssdp.Scanner._async_start_ssdp_listeners"),
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
"""Test config flow."""
|
"""Test config flow."""
|
||||||
|
|
||||||
|
from collections.abc import Generator
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
|
||||||
from aiomusiccast import MusicCastConnectionException
|
from aiomusiccast import MusicCastConnectionException
|
||||||
@ -17,7 +18,7 @@ from tests.common import MockConfigEntry
|
|||||||
|
|
||||||
|
|
||||||
@pytest.fixture(autouse=True)
|
@pytest.fixture(autouse=True)
|
||||||
async def silent_ssdp_scanner(hass):
|
def silent_ssdp_scanner() -> Generator[None]:
|
||||||
"""Start SSDP component and get Scanner, prevent actual SSDP traffic."""
|
"""Start SSDP component and get Scanner, prevent actual SSDP traffic."""
|
||||||
with (
|
with (
|
||||||
patch("homeassistant.components.ssdp.Scanner._async_start_ssdp_listeners"),
|
patch("homeassistant.components.ssdp.Scanner._async_start_ssdp_listeners"),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user