1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 21:06:19 +00:00

Enable Ruff B017 (#115335)

This commit is contained in:
Sid
2024-04-15 22:25:09 +02:00
committed by GitHub
parent c7e6f3696f
commit 5f055a64bb
6 changed files with 16 additions and 11 deletions

View File

@@ -107,7 +107,7 @@ class FakeBleakClientRaisesOnConnect(BaseFakeBleakClient):
async def connect(self, *args, **kwargs):
"""Connect."""
raise Exception("Test exception")
raise ConnectionError("Test exception")
def _generate_ble_device_and_adv_data(
@@ -304,8 +304,9 @@ async def test_release_slot_on_connect_exception(
):
ble_device = hci0_device_advs["00:00:00:00:00:01"][0]
client = bleak.BleakClient(ble_device)
with pytest.raises(Exception):
assert await client.connect() is False
with pytest.raises(ConnectionError) as exc_info:
await client.connect()
assert str(exc_info.value) == "Test exception"
assert allocate_slot_mock.call_count == 1
assert release_slot_mock.call_count == 1