From 995430976f39df67f93966561b4e624012c95471 Mon Sep 17 00:00:00 2001 From: Ashley Gittins Date: Sat, 6 Apr 2024 18:34:11 +0000 Subject: [PATCH 1/2] fix loading of bluetooth_adapters in tests --- tests/conftest.py | 10 +++++----- tests/test_config_flow.py | 1 + 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index ac3e06d..9d15176 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -14,6 +14,11 @@ pytest_plugins = "pytest_homeassistant_custom_component" +@pytest.fixture(autouse=True) +def mock_bluetooth(enable_bluetooth): + """Auto mock bluetooth.""" + + # This fixture enables loading custom integrations in all tests. # Remove to enable selective use of this fixture @pytest.fixture(autouse=True) @@ -60,11 +65,6 @@ def error_get_data_fixture(): yield -@pytest.fixture(autouse=True) -def mock_bluetooth(enable_bluetooth): - """Auto mock bluetooth.""" - - # This fixture ensures that the config flow gets service info for the anticipated address # to go into configured_devices @pytest.fixture(autouse=True) diff --git a/tests/test_config_flow.py b/tests/test_config_flow.py index 55a0915..c425448 100644 --- a/tests/test_config_flow.py +++ b/tests/test_config_flow.py @@ -7,6 +7,7 @@ import pytest from homeassistant import config_entries from homeassistant import data_entry_flow +from homeassistant.core import HomeAssistant # noqa: F401 from pytest_homeassistant_custom_component.common import MockConfigEntry from custom_components.bermuda.const import DOMAIN From f3a81519729c5e3b54bde8468afd6c714293b2bf Mon Sep 17 00:00:00 2001 From: Ashley Gittins Date: Sat, 6 Apr 2024 18:44:44 +0000 Subject: [PATCH 2/2] Add missing pyudev for github tests flow --- requirements_test.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/requirements_test.txt b/requirements_test.txt index a35b291..ef41c09 100644 --- a/requirements_test.txt +++ b/requirements_test.txt @@ -5,5 +5,7 @@ pytest-homeassistant-custom-component pre-commit isort black==24.3.0 +# AJG 2024-04-07: github not completing tests due to this. +pyudev pyserial-asyncio==0.6 pyserial==3.5