Move socket_enabled fixture to decorator (#118847)

This commit is contained in:
epenet 2024-06-06 17:27:38 +02:00 committed by GitHub
parent 6de26ca811
commit fb51163075
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 11 additions and 12 deletions

View File

@ -186,9 +186,8 @@ async def test_pipeline_events(
)
@pytest.mark.usefixtures("socket_enabled")
async def test_udp_server(
hass: HomeAssistant,
socket_enabled: None,
unused_udp_port_factory: Callable[[], int],
voice_assistant_udp_pipeline_v1: VoiceAssistantUDPPipeline,
) -> None:
@ -313,9 +312,8 @@ async def test_error_calls_handle_finished(
voice_assistant_udp_pipeline_v1.handle_finished.assert_called()
@pytest.mark.usefixtures("socket_enabled")
async def test_udp_server_multiple(
hass: HomeAssistant,
socket_enabled: None,
unused_udp_port_factory: Callable[[], int],
voice_assistant_udp_pipeline_v1: VoiceAssistantUDPPipeline,
) -> None:
@ -336,9 +334,8 @@ async def test_udp_server_multiple(
await voice_assistant_udp_pipeline_v1.start_server()
@pytest.mark.usefixtures("socket_enabled")
async def test_udp_server_after_stopped(
hass: HomeAssistant,
socket_enabled: None,
unused_udp_port_factory: Callable[[], int],
voice_assistant_udp_pipeline_v1: VoiceAssistantUDPPipeline,
) -> None:

View File

@ -62,6 +62,7 @@ async def setup_diag(hass):
@freeze_time("2023-03-13 12:05:00-07:00")
@pytest.mark.usefixtures("socket_enabled")
async def test_diagnostics(
hass: HomeAssistant,
component_setup: ComponentSetup,
@ -70,7 +71,6 @@ async def test_diagnostics(
hass_admin_credential: Credentials,
config_entry: MockConfigEntry,
aiohttp_client: ClientSessionGenerator,
socket_enabled: None,
snapshot: SnapshotAssertion,
aioclient_mock: AiohttpClientMocker,
) -> None:

View File

@ -320,10 +320,10 @@ async def test_api_ingress_panels(
("update_diagnostics", "POST", True),
],
)
@pytest.mark.usefixtures("socket_enabled")
async def test_api_headers(
aiohttp_raw_server, # 'aiohttp_raw_server' must be before 'hass'!
hass: HomeAssistant,
socket_enabled: None,
api_call: str,
method: Literal["GET", "POST"],
payload: Any,

View File

@ -48,6 +48,7 @@ async def setup_diag(hass):
@freeze_time("2023-03-13 12:05:00-07:00")
@pytest.mark.usefixtures("socket_enabled")
async def test_empty_calendar(
hass: HomeAssistant,
setup_integration: None,
@ -55,7 +56,6 @@ async def test_empty_calendar(
hass_admin_credential: Credentials,
config_entry: MockConfigEntry,
aiohttp_client: ClientSessionGenerator,
socket_enabled: None,
snapshot: SnapshotAssertion,
) -> None:
"""Test diagnostics against an empty calendar."""
@ -76,6 +76,7 @@ async def test_empty_calendar(
@freeze_time("2023-03-13 12:05:00-07:00")
@pytest.mark.usefixtures("socket_enabled")
async def test_api_date_time_event(
hass: HomeAssistant,
setup_integration: None,
@ -84,7 +85,6 @@ async def test_api_date_time_event(
config_entry: MockConfigEntry,
hass_ws_client: WebSocketGenerator,
aiohttp_client: ClientSessionGenerator,
socket_enabled: None,
snapshot: SnapshotAssertion,
) -> None:
"""Test an event with a start/end date time."""

View File

@ -2,6 +2,7 @@
from aiohttp.test_utils import TestClient
from freezegun import freeze_time
import pytest
from syrupy import SnapshotAssertion
from homeassistant.auth.models import Credentials
@ -50,12 +51,12 @@ def limit_diagnostic_attrs(prop, path) -> bool:
@freeze_time("2024-04-06 00:00:00+00:00")
@pytest.mark.usefixtures("socket_enabled")
async def test_diagnostics(
hass: HomeAssistant,
aiohttp_client: ClientSessionGenerator,
hass_admin_user: MockUser,
hass_admin_credential: Credentials,
socket_enabled: None,
snapshot: SnapshotAssertion,
) -> None:
"""Test generating diagnostics for a config entry."""

View File

@ -9,7 +9,8 @@ from homeassistant.components import voip
from homeassistant.core import HomeAssistant
async def test_create_sip_server(hass: HomeAssistant, socket_enabled: None) -> None:
@pytest.mark.usefixtures("socket_enabled")
async def test_create_sip_server(hass: HomeAssistant) -> None:
"""Tests starting/stopping SIP server."""
result = await hass.config_entries.flow.async_init(
voip.DOMAIN, context={"source": config_entries.SOURCE_USER}