Skip to content

Commit af45ebe

Browse files
committed
patch fixture issue
1 parent b48b9f9 commit af45ebe

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ all [contributors of aiobmsble](https://github.com/patman15/aiobmsble?tab=readme
337337
[license-shield]: https://img.shields.io/github/license/patman15/BMS_BLE-HA?style=for-the-badge&color=orange&cacheSeconds=86400
338338
[releases-shield]: https://img.shields.io/github/release/patman15/BMS_BLE-HA.svg?style=for-the-badge&cacheSeconds=14400
339339
[releases]: https://github.com//patman15/BMS_BLE-HA/releases
340-
[effort-shield]: https://img.shields.io/badge/Effort%20spent-1060_hours-gold?style=for-the-badge&cacheSeconds=86400
340+
[effort-shield]: https://img.shields.io/badge/Effort%20spent-1065_hours-gold?style=for-the-badge&cacheSeconds=86400
341341
[install-shield]: https://img.shields.io/badge/dynamic/json?style=for-the-badge&color=green&label=HACS&suffix=%20Installs&cacheSeconds=15600&url=https://analytics.home-assistant.io/custom_integrations.json&query=$.bms_ble.total&cacheSeconds=14400
342342
[btproxy-url]: https://esphome.io/components/bluetooth_proxy
343343
[custint-url]: https://www.home-assistant.io/common-tasks/general/#defining-a-custom-polling-interval

tests/conftest.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from collections.abc import Awaitable, Buffer, Callable, Iterable
44
import logging
55
from typing import Any, Final
6+
from unittest.mock import MagicMock
67
from uuid import UUID
78

89
from aiobmsble import BMSInfo, BMSSample, MatcherPattern
@@ -42,6 +43,16 @@ def auto_enable_custom_integrations(enable_custom_integrations: None) -> None:
4243
return
4344

4445

46+
@pytest.fixture(autouse=True)
47+
def fix_HaScanner_patch(monkeypatch: pytest.MonkeyPatch) -> None:
48+
"""Patch HaScanner to avoid BT discovery.
49+
50+
fixes https://github.com/MatthewFlamm/pytest-homeassistant-custom-component/pull/255
51+
TODO: remove when pytest-homeassistant-custom-component is updated or fixed upstream
52+
"""
53+
monkeypatch.setattr("homeassistant.components.bluetooth.HaScanner", MagicMock())
54+
55+
4556
@pytest.fixture(params=[False, True])
4657
def bool_fixture(request: pytest.FixtureRequest) -> bool:
4758
"""Return False, True for tests."""

0 commit comments

Comments
 (0)