From 7e75245d549d01ac4f01ee615c193c00cf3269a7 Mon Sep 17 00:00:00 2001 From: Jim Mussared Date: Thu, 12 Nov 2020 23:05:47 +1100 Subject: [PATCH] tests/multi_bluetooth: Change dict index-and-del to pop, to clear event. Signed-off-by: Jim Mussared --- tests/multi_bluetooth/ble_characteristic.py | 4 +--- tests/multi_bluetooth/ble_gap_connect.py | 4 +--- tests/multi_bluetooth/ble_gap_device_name.py | 4 +--- tests/multi_bluetooth/ble_gatt_data_transfer.py | 4 +--- tests/multi_bluetooth/ble_gattc_discover_services.py | 4 +--- tests/multi_bluetooth/ble_mtu.py | 4 +--- 6 files changed, 6 insertions(+), 18 deletions(-) diff --git a/tests/multi_bluetooth/ble_characteristic.py b/tests/multi_bluetooth/ble_characteristic.py index 0f22daff88..327822a01e 100644 --- a/tests/multi_bluetooth/ble_characteristic.py +++ b/tests/multi_bluetooth/ble_characteristic.py @@ -77,9 +77,7 @@ def wait_for_event(event, timeout_ms): t0 = time.ticks_ms() while time.ticks_diff(time.ticks_ms(), t0) < timeout_ms: if event in waiting_events: - result = waiting_events[event] - del waiting_events[event] - return result + return waiting_events.pop(event) machine.idle() raise ValueError("Timeout waiting for {}".format(event)) diff --git a/tests/multi_bluetooth/ble_gap_connect.py b/tests/multi_bluetooth/ble_gap_connect.py index 2c1d2cbbc5..95d1be7baa 100644 --- a/tests/multi_bluetooth/ble_gap_connect.py +++ b/tests/multi_bluetooth/ble_gap_connect.py @@ -33,9 +33,7 @@ def wait_for_event(event, timeout_ms): t0 = time.ticks_ms() while time.ticks_diff(time.ticks_ms(), t0) < timeout_ms: if event in waiting_events: - result = waiting_events[event] - del waiting_events[event] - return result + return waiting_events.pop(event) machine.idle() raise ValueError("Timeout waiting for {}".format(event)) diff --git a/tests/multi_bluetooth/ble_gap_device_name.py b/tests/multi_bluetooth/ble_gap_device_name.py index e7202170bd..556068114b 100644 --- a/tests/multi_bluetooth/ble_gap_device_name.py +++ b/tests/multi_bluetooth/ble_gap_device_name.py @@ -49,9 +49,7 @@ def wait_for_event(event, timeout_ms): t0 = time.ticks_ms() while time.ticks_diff(time.ticks_ms(), t0) < timeout_ms: if event in waiting_events: - result = waiting_events[event] - del waiting_events[event] - return result + return waiting_events.pop(event) machine.idle() raise ValueError("Timeout waiting for {}".format(event)) diff --git a/tests/multi_bluetooth/ble_gatt_data_transfer.py b/tests/multi_bluetooth/ble_gatt_data_transfer.py index e8249b3da8..861cb49fc3 100644 --- a/tests/multi_bluetooth/ble_gatt_data_transfer.py +++ b/tests/multi_bluetooth/ble_gatt_data_transfer.py @@ -76,9 +76,7 @@ def wait_for_event(event, timeout_ms): t0 = time.ticks_ms() while time.ticks_diff(time.ticks_ms(), t0) < timeout_ms: if event in waiting_events: - result = waiting_events[event] - del waiting_events[event] - return result + return waiting_events.pop(event) machine.idle() raise ValueError("Timeout waiting for {}".format(event)) diff --git a/tests/multi_bluetooth/ble_gattc_discover_services.py b/tests/multi_bluetooth/ble_gattc_discover_services.py index 00bb94bba0..f6ee5fa00e 100644 --- a/tests/multi_bluetooth/ble_gattc_discover_services.py +++ b/tests/multi_bluetooth/ble_gattc_discover_services.py @@ -55,9 +55,7 @@ def wait_for_event(event, timeout_ms): t0 = time.ticks_ms() while time.ticks_diff(time.ticks_ms(), t0) < timeout_ms: if event in waiting_events: - result = waiting_events[event] - del waiting_events[event] - return result + return waiting_events.pop(event) machine.idle() raise ValueError("Timeout waiting for {}".format(event)) diff --git a/tests/multi_bluetooth/ble_mtu.py b/tests/multi_bluetooth/ble_mtu.py index 73c77e2460..f202ec764d 100644 --- a/tests/multi_bluetooth/ble_mtu.py +++ b/tests/multi_bluetooth/ble_mtu.py @@ -87,9 +87,7 @@ def wait_for_event(event, timeout_ms): t0 = time.ticks_ms() while time.ticks_diff(time.ticks_ms(), t0) < timeout_ms: if event in waiting_events: - result = waiting_events[event] - del waiting_events[event] - return result + return waiting_events.pop(event) machine.idle() raise ValueError("Timeout waiting for {}".format(event))