Move None bluetooth fixtures to decorator (#118802)

This commit is contained in:
epenet 2024-06-04 16:26:07 +02:00 committed by GitHub
parent f120f55d86
commit 80975d7a63
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 253 additions and 230 deletions

View file

@ -1,5 +1,6 @@
"""Tests for the bluetooth component."""
from collections.abc import Generator
from unittest.mock import patch
from bleak_retry_connector import bleak_manager
@ -74,7 +75,7 @@ def mock_operating_system_90():
@pytest.fixture(name="macos_adapter")
def macos_adapter():
def macos_adapter() -> Generator[None, None, None]:
"""Fixture that mocks the macos adapter."""
with (
patch("bleak.get_platform_scanner_backend_type"),
@ -109,7 +110,7 @@ def windows_adapter():
@pytest.fixture(name="no_adapters")
def no_adapter_fixture():
def no_adapter_fixture() -> Generator[None, None, None]:
"""Fixture that mocks no adapters on Linux."""
with (
patch(
@ -137,7 +138,7 @@ def no_adapter_fixture():
@pytest.fixture(name="one_adapter")
def one_adapter_fixture():
def one_adapter_fixture() -> Generator[None, None, None]:
"""Fixture that mocks one adapter on Linux."""
with (
patch(
@ -176,7 +177,7 @@ def one_adapter_fixture():
@pytest.fixture(name="two_adapters")
def two_adapters_fixture():
def two_adapters_fixture() -> Generator[None, None, None]:
"""Fixture that mocks two adapters on Linux."""
with (
patch(