Update pytest-asyncio to 1.0.0 (#145988)

* Update pytest-asyncio to 1.0.0

* Remove event_loop fixture uses
This commit is contained in:
Marc Mueller
2025-06-02 06:12:22 +02:00
committed by GitHub
parent dd85a1e5f0
commit 5e377b89fc
11 changed files with 22 additions and 35 deletions
-3
View File
@@ -1,7 +1,5 @@
"""Test configuration for auth."""
from asyncio import AbstractEventLoop
import pytest
from tests.typing import ClientSessionGenerator
@@ -9,7 +7,6 @@ from tests.typing import ClientSessionGenerator
@pytest.fixture
def aiohttp_client(
event_loop: AbstractEventLoop,
aiohttp_client: ClientSessionGenerator,
socket_enabled: None,
) -> ClientSessionGenerator:
@@ -1,6 +1,5 @@
"""The tests for the emulated Hue component."""
from asyncio import AbstractEventLoop
from collections.abc import Generator
from http import HTTPStatus
import json
@@ -38,7 +37,6 @@ class MockTransport:
@pytest.fixture
def aiohttp_client(
event_loop: AbstractEventLoop,
aiohttp_client: ClientSessionGenerator,
socket_enabled: None,
) -> ClientSessionGenerator:
-2
View File
@@ -1,6 +1,5 @@
"""The tests for Home Assistant frontend."""
from asyncio import AbstractEventLoop
from collections.abc import Generator
from http import HTTPStatus
from pathlib import Path
@@ -95,7 +94,6 @@ async def frontend_themes(hass: HomeAssistant) -> None:
@pytest.fixture
def aiohttp_client(
event_loop: AbstractEventLoop,
aiohttp_client: ClientSessionGenerator,
socket_enabled: None,
) -> ClientSessionGenerator:
+6 -4
View File
@@ -1,6 +1,6 @@
"""HomeKit session fixtures."""
from asyncio import AbstractEventLoop
import asyncio
from collections.abc import Generator
from contextlib import suppress
import os
@@ -26,12 +26,13 @@ def iid_storage(hass: HomeAssistant) -> Generator[AccessoryIIDStorage]:
@pytest.fixture
def run_driver(
hass: HomeAssistant, event_loop: AbstractEventLoop, iid_storage: AccessoryIIDStorage
hass: HomeAssistant, iid_storage: AccessoryIIDStorage
) -> Generator[HomeDriver]:
"""Return a custom AccessoryDriver instance for HomeKit accessory init.
This mock does not mock async_stop, so the driver will not be stopped
"""
event_loop = asyncio.get_event_loop()
with (
patch("pyhap.accessory_driver.AsyncZeroconf"),
patch("pyhap.accessory_driver.AccessoryEncoder"),
@@ -55,9 +56,10 @@ def run_driver(
@pytest.fixture
def hk_driver(
hass: HomeAssistant, event_loop: AbstractEventLoop, iid_storage: AccessoryIIDStorage
hass: HomeAssistant, iid_storage: AccessoryIIDStorage
) -> Generator[HomeDriver]:
"""Return a custom AccessoryDriver instance for HomeKit accessory init."""
event_loop = asyncio.get_event_loop()
with (
patch("pyhap.accessory_driver.AsyncZeroconf"),
patch("pyhap.accessory_driver.AccessoryEncoder"),
@@ -85,11 +87,11 @@ def hk_driver(
@pytest.fixture
def mock_hap(
hass: HomeAssistant,
event_loop: AbstractEventLoop,
iid_storage: AccessoryIIDStorage,
mock_zeroconf: MagicMock,
) -> Generator[HomeDriver]:
"""Return a custom AccessoryDriver instance for HomeKit accessory init."""
event_loop = asyncio.get_event_loop()
with (
patch("pyhap.accessory_driver.AsyncZeroconf"),
patch("pyhap.accessory_driver.AccessoryEncoder"),
-3
View File
@@ -1,7 +1,5 @@
"""Test configuration for http."""
from asyncio import AbstractEventLoop
import pytest
from tests.typing import ClientSessionGenerator
@@ -9,7 +7,6 @@ from tests.typing import ClientSessionGenerator
@pytest.fixture
def aiohttp_client(
event_loop: AbstractEventLoop,
aiohttp_client: ClientSessionGenerator,
socket_enabled: None,
) -> ClientSessionGenerator:
@@ -1,6 +1,5 @@
"""The tests for the image_processing component."""
from asyncio import AbstractEventLoop
from collections.abc import Callable
from unittest.mock import PropertyMock, patch
@@ -26,7 +25,6 @@ async def setup_homeassistant(hass: HomeAssistant):
@pytest.fixture
def aiohttp_unused_port_factory(
event_loop: AbstractEventLoop,
unused_tcp_port_factory: Callable[[], int],
socket_enabled: None,
) -> Callable[[], int]:
@@ -1,6 +1,5 @@
"""Test the motionEye camera."""
from asyncio import AbstractEventLoop
from collections.abc import Callable
import copy
from unittest.mock import AsyncMock, Mock, call
@@ -67,7 +66,6 @@ from tests.common import async_fire_time_changed
@pytest.fixture
def aiohttp_server(
event_loop: AbstractEventLoop,
aiohttp_server: Callable[[], TestServer],
socket_enabled: None,
) -> Callable[[], TestServer]: