Improve type hints for mock_bluetooth/enable_bluetooth (#118484)

This commit is contained in:
epenet 2024-05-31 04:16:45 +02:00 committed by GitHub
parent 2b7685b71d
commit 83e77720e9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
45 changed files with 49 additions and 47 deletions

View File

@ -4,5 +4,5 @@ import pytest
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
def mock_bluetooth(enable_bluetooth): def mock_bluetooth(enable_bluetooth: None) -> None:
"""Auto mock bluetooth.""" """Auto mock bluetooth."""

View File

@ -4,5 +4,5 @@ import pytest
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
def mock_bluetooth(enable_bluetooth): def mock_bluetooth(enable_bluetooth: None) -> None:
"""Auto mock bluetooth.""" """Auto mock bluetooth."""

View File

@ -4,5 +4,5 @@ import pytest
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
def mock_bluetooth(enable_bluetooth): def mock_bluetooth(enable_bluetooth: None) -> None:
"""Auto mock bluetooth.""" """Auto mock bluetooth."""

View File

@ -4,5 +4,5 @@ import pytest
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
def mock_bluetooth(enable_bluetooth): def mock_bluetooth(enable_bluetooth: None) -> None:
"""Auto mock bluetooth.""" """Auto mock bluetooth."""

View File

@ -4,5 +4,5 @@ import pytest
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
def mock_bluetooth(enable_bluetooth): def mock_bluetooth(enable_bluetooth: None) -> None:
"""Auto mock bluetooth.""" """Auto mock bluetooth."""

View File

@ -4,5 +4,5 @@ import pytest
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
def mock_bluetooth(enable_bluetooth): def mock_bluetooth(enable_bluetooth: None) -> None:
"""Auto mock bluetooth.""" """Auto mock bluetooth."""

View File

@ -4,5 +4,5 @@ import pytest
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
def mock_bluetooth(enable_bluetooth): def mock_bluetooth(enable_bluetooth: None) -> None:
"""Auto mock bluetooth.""" """Auto mock bluetooth."""

View File

@ -11,7 +11,7 @@ from tests.components.bluetooth import generate_ble_device
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
def mock_bluetooth(enable_bluetooth): def mock_bluetooth(enable_bluetooth: None) -> None:
"""Auto mock bluetooth.""" """Auto mock bluetooth."""

View File

@ -41,7 +41,7 @@ from tests.common import MockConfigEntry
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
def mock_bluetooth(enable_bluetooth): def mock_bluetooth(enable_bluetooth: None) -> None:
"""Auto mock bluetooth.""" """Auto mock bluetooth."""

View File

@ -4,5 +4,5 @@ import pytest
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
def mock_bluetooth(enable_bluetooth): def mock_bluetooth(enable_bluetooth: None) -> None:
"""Auto mock bluetooth.""" """Auto mock bluetooth."""

View File

@ -6,5 +6,5 @@ import pytest
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
def mock_bluetooth(enable_bluetooth): def mock_bluetooth(enable_bluetooth: None) -> None:
"""Auto mock bluetooth.""" """Auto mock bluetooth."""

View File

@ -4,5 +4,5 @@ import pytest
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
def mock_bluetooth(enable_bluetooth): def mock_bluetooth(enable_bluetooth: None) -> None:
"""Auto mock bluetooth.""" """Auto mock bluetooth."""

View File

@ -40,7 +40,7 @@ from tests.components.bluetooth import (
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
def mock_bluetooth(enable_bluetooth): def mock_bluetooth(enable_bluetooth: None) -> None:
"""Auto mock bluetooth.""" """Auto mock bluetooth."""

View File

@ -42,7 +42,7 @@ from tests.components.bluetooth import (
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
def mock_bluetooth(enable_bluetooth): def mock_bluetooth(enable_bluetooth: None) -> None:
"""Auto mock bluetooth.""" """Auto mock bluetooth."""

View File

@ -15,7 +15,7 @@ from tests.typing import WebSocketGenerator
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
def mock_bluetooth(enable_bluetooth): def mock_bluetooth(enable_bluetooth: None) -> None:
"""Auto mock bluetooth.""" """Auto mock bluetooth."""

View File

@ -34,7 +34,7 @@ from tests.components.bluetooth import (
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
def mock_bluetooth(enable_bluetooth): def mock_bluetooth(enable_bluetooth: None) -> None:
"""Auto mock bluetooth.""" """Auto mock bluetooth."""

View File

@ -1,6 +1,6 @@
"""IKEA Idasen Desk fixtures.""" """IKEA Idasen Desk fixtures."""
from collections.abc import Callable from collections.abc import Callable, Generator
from unittest import mock from unittest import mock
from unittest.mock import AsyncMock, MagicMock from unittest.mock import AsyncMock, MagicMock
@ -8,12 +8,12 @@ import pytest
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
def mock_bluetooth(enable_bluetooth): def mock_bluetooth(enable_bluetooth: None) -> Generator[None, None, None]:
"""Auto mock bluetooth.""" """Auto mock bluetooth."""
with mock.patch( with mock.patch(
"homeassistant.components.idasen_desk.bluetooth.async_ble_device_from_address" "homeassistant.components.idasen_desk.bluetooth.async_ble_device_from_address"
): ):
yield MagicMock() yield
@pytest.fixture(autouse=False) @pytest.fixture(autouse=False)

View File

@ -4,5 +4,5 @@ import pytest
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
def mock_bluetooth(enable_bluetooth): def mock_bluetooth(enable_bluetooth: None) -> None:
"""Auto mock bluetooth.""" """Auto mock bluetooth."""

View File

@ -4,5 +4,5 @@ import pytest
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
def mock_bluetooth(enable_bluetooth): def mock_bluetooth(enable_bluetooth: None) -> None:
"""Auto mock bluetooth.""" """Auto mock bluetooth."""

View File

@ -4,5 +4,5 @@ import pytest
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
def mock_bluetooth(enable_bluetooth): def mock_bluetooth(enable_bluetooth: None) -> None:
"""Auto mock bluetooth.""" """Auto mock bluetooth."""

View File

@ -4,5 +4,5 @@ import pytest
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
def mock_bluetooth(enable_bluetooth): def mock_bluetooth(enable_bluetooth: None) -> None:
"""Auto mock bluetooth.""" """Auto mock bluetooth."""

View File

@ -133,5 +133,5 @@ def remove_local_connection(
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
def mock_bluetooth(enable_bluetooth): def mock_bluetooth(enable_bluetooth: None) -> None:
"""Auto mock bluetooth.""" """Auto mock bluetooth."""

View File

@ -4,5 +4,5 @@ import pytest
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
def mock_bluetooth(enable_bluetooth): def mock_bluetooth(enable_bluetooth: None) -> None:
"""Auto mock bluetooth.""" """Auto mock bluetooth."""

View File

@ -4,5 +4,5 @@ import pytest
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
def mock_bluetooth(enable_bluetooth): def mock_bluetooth(enable_bluetooth: None) -> None:
"""Auto mock bluetooth.""" """Auto mock bluetooth."""

View File

@ -4,5 +4,5 @@ import pytest
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
def mock_bluetooth(enable_bluetooth): def mock_bluetooth(enable_bluetooth: None) -> None:
"""Auto mock bluetooth.""" """Auto mock bluetooth."""

View File

@ -4,5 +4,5 @@ import pytest
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
def mock_bluetooth(enable_bluetooth): def mock_bluetooth(enable_bluetooth: None) -> None:
"""Auto mock bluetooth.""" """Auto mock bluetooth."""

View File

@ -57,7 +57,7 @@ FAKE_SERVICE_INFO_2 = BluetoothServiceInfoBleak(
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
def mock_bluetooth(enable_bluetooth): def mock_bluetooth(enable_bluetooth: None) -> None:
"""Auto mock bluetooth.""" """Auto mock bluetooth."""

View File

@ -4,5 +4,5 @@ import pytest
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
def mock_bluetooth(enable_bluetooth): def mock_bluetooth(enable_bluetooth: None) -> None:
"""Auto mock bluetooth.""" """Auto mock bluetooth."""

View File

@ -4,5 +4,5 @@ import pytest
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
def mock_bluetooth(enable_bluetooth): def mock_bluetooth(enable_bluetooth: None) -> None:
"""Auto mock bluetooth.""" """Auto mock bluetooth."""

View File

@ -1,5 +1,6 @@
"""OralB session fixtures.""" """OralB session fixtures."""
from collections.abc import Generator
from unittest import mock from unittest import mock
import pytest import pytest
@ -44,7 +45,7 @@ class MockBleakClientBattery49(MockBleakClient):
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
def mock_bluetooth(enable_bluetooth): def mock_bluetooth(enable_bluetooth: None) -> Generator[None, None, None]:
"""Auto mock bluetooth.""" """Auto mock bluetooth."""
with mock.patch( with mock.patch(

View File

@ -4,5 +4,5 @@ import pytest
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
def mock_bluetooth(enable_bluetooth): def mock_bluetooth(enable_bluetooth: None) -> None:
"""Auto mock bluetooth.""" """Auto mock bluetooth."""

View File

@ -4,5 +4,5 @@ import pytest
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
def mock_bluetooth(enable_bluetooth): def mock_bluetooth(enable_bluetooth: None) -> None:
"""Auto mock bluetooth.""" """Auto mock bluetooth."""

View File

@ -4,5 +4,5 @@ import pytest
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
def mock_bluetooth(enable_bluetooth): def mock_bluetooth(enable_bluetooth: None) -> None:
"""Auto mock bluetooth.""" """Auto mock bluetooth."""

View File

@ -15,7 +15,7 @@ from tests.common import MockConfigEntry
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
def mock_bluetooth(enable_bluetooth): def mock_bluetooth(enable_bluetooth: None) -> None:
"""Mock bluetooth for all tests in this module.""" """Mock bluetooth for all tests in this module."""

View File

@ -19,7 +19,7 @@ from tests.common import MockConfigEntry
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
def mock_bluetooth(enable_bluetooth): def mock_bluetooth(enable_bluetooth: None) -> None:
"""Mock bluetooth for all tests in this module.""" """Mock bluetooth for all tests in this module."""

View File

@ -4,5 +4,5 @@ import pytest
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
def mock_bluetooth(enable_bluetooth): def mock_bluetooth(enable_bluetooth: None) -> None:
"""Auto mock bluetooth.""" """Auto mock bluetooth."""

View File

@ -4,5 +4,5 @@ import pytest
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
def mock_bluetooth(enable_bluetooth): def mock_bluetooth(enable_bluetooth: None) -> None:
"""Auto mock bluetooth.""" """Auto mock bluetooth."""

View File

@ -409,5 +409,5 @@ async def mock_rpc_device():
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
def mock_bluetooth(enable_bluetooth): def mock_bluetooth(enable_bluetooth: None) -> None:
"""Auto mock bluetooth.""" """Auto mock bluetooth."""

View File

@ -10,7 +10,7 @@ from . import SnoozFixture, create_mock_snooz, create_mock_snooz_config_entry
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
def mock_bluetooth(enable_bluetooth): def mock_bluetooth(enable_bluetooth: None) -> None:
"""Auto mock bluetooth.""" """Auto mock bluetooth."""

View File

@ -4,5 +4,5 @@ import pytest
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
def mock_bluetooth(enable_bluetooth): def mock_bluetooth(enable_bluetooth: None) -> None:
"""Auto mock bluetooth.""" """Auto mock bluetooth."""

View File

@ -4,5 +4,5 @@ import pytest
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
def mock_bluetooth(enable_bluetooth): def mock_bluetooth(enable_bluetooth: None) -> None:
"""Auto mock bluetooth.""" """Auto mock bluetooth."""

View File

@ -4,5 +4,5 @@ import pytest
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
def mock_bluetooth(enable_bluetooth): def mock_bluetooth(enable_bluetooth: None) -> None:
"""Auto mock bluetooth.""" """Auto mock bluetooth."""

View File

@ -4,5 +4,5 @@ import pytest
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
def mock_bluetooth(enable_bluetooth): def mock_bluetooth(enable_bluetooth: None) -> None:
"""Auto mock bluetooth.""" """Auto mock bluetooth."""

View File

@ -1,5 +1,6 @@
"""Session fixtures.""" """Session fixtures."""
from collections.abc import Generator
from unittest import mock from unittest import mock
import pytest import pytest
@ -44,7 +45,7 @@ class MockBleakClientBattery5(MockBleakClient):
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
def mock_bluetooth(enable_bluetooth): def mock_bluetooth(enable_bluetooth: None) -> Generator[None, None, None]:
"""Auto mock bluetooth.""" """Auto mock bluetooth."""
with mock.patch("xiaomi_ble.parser.BleakClient", MockBleakClientBattery5): with mock.patch("xiaomi_ble.parser.BleakClient", MockBleakClientBattery5):

View File

@ -4,5 +4,5 @@ import pytest
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
def mock_bluetooth(enable_bluetooth): def mock_bluetooth(enable_bluetooth: None) -> None:
"""Auto mock bluetooth.""" """Auto mock bluetooth."""