diff --git a/smpclient/transport/ble.py b/smpclient/transport/ble.py index fc50091..4b66f77 100644 --- a/smpclient/transport/ble.py +++ b/smpclient/transport/ble.py @@ -85,7 +85,7 @@ async def connect(self, address: str, timeout_s: float) -> None: device: BLEDevice | None = ( await BleakScanner.find_device_by_address(address, timeout=timeout_s) if MAC_ADDRESS_PATTERN.match(address) or UUID_PATTERN.match(address) - else await BleakScanner.find_device_by_name(address) + else await BleakScanner.find_device_by_name(address, timeout=timeout_s) ) if type(device) is BLEDevice: diff --git a/tests/test_smp_ble_transport.py b/tests/test_smp_ble_transport.py index f469438..fd4d2a3 100644 --- a/tests/test_smp_ble_transport.py +++ b/tests/test_smp_ble_transport.py @@ -87,7 +87,7 @@ async def test_connect( ) -> None: # assert that it searches by name if MAC or UUID is not provided await SMPBLETransport().connect("device name", 1.0) - mock_find_device_by_name.assert_called_once_with("device name") + mock_find_device_by_name.assert_called_once_with("device name", timeout=1.0) mock_find_device_by_name.reset_mock() # assert that it searches by MAC if MAC is provided