Skip to content

Commit 2c621b5

Browse files
committed
run unload test only once
all BMSs are identical for unload, so one test is sufficient. Better scales with increasing number of BMSs
1 parent fa2eaa8 commit 2c621b5

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

tests/test_init.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ async def mock_coord_shutdown(_self) -> None:
6868
@pytest.mark.usefixtures("enable_bluetooth", "patch_default_bleak_client")
6969
async def test_unload_entry(
7070
monkeypatch: pytest.MonkeyPatch,
71-
bms_fixture: str,
7271
bool_fixture: bool,
7372
bt_discovery: BluetoothServiceInfoBleak,
7473
hass: HomeAssistant,
@@ -79,12 +78,12 @@ async def test_unload_entry(
7978
# first load entry (see test_async_setup_entry)
8079
inject_bluetooth_service_info_bleak(hass, bt_discovery)
8180

82-
cfg: MockConfigEntry = mock_config(bms=bms_fixture)
81+
cfg: MockConfigEntry = mock_config()
8382
cfg.add_to_hass(hass)
8483

85-
bms_module: Final[str] = f"aiobmsble.bms.{bms_fixture}"
86-
monkeypatch.setattr(f"{bms_module}.BMS.device_info", mock_devinfo_min)
87-
monkeypatch.setattr(f"{bms_module}.BMS.async_update", mock_update_min)
84+
bms_class: Final[str] = "aiobmsble.bms.dummy_bms.BMS"
85+
monkeypatch.setattr(f"{bms_class}.device_info", mock_devinfo_min)
86+
monkeypatch.setattr(f"{bms_class}.async_update", mock_update_min)
8887

8988
async def mock_coord_shutdown(_self) -> None:
9089
trace_fct["shutdown_called"] = True

0 commit comments

Comments
 (0)