ble - fixing test_driver after cleanup - double result printout gone maybe
This commit is contained in:
1 parent
447d600416
commit
a1e050c688
1 file changed
+5
-20
+5
-20
@@ -270,10 +270,6 @@ def test_driver(test_count = 0, bt_usb_id = None):
|
|||||||
# this gets MACs from the comment dict in config
|
# this gets MACs from the comment dict in config
|
||||||
for mac in comment_lookup:
|
for mac in comment_lookup:
|
||||||
mac_list.append(mac['mac'])
|
mac_list.append(mac['mac'])
|
||||||
mac_list = [
|
|
||||||
"A4:C1:38:11:F4:2A",
|
|
||||||
"A4:C1:38:D7:8D:26"
|
|
||||||
]
|
|
||||||
log.info("Starting BLE test...")
|
log.info("Starting BLE test...")
|
||||||
log.info(f" Scanning MACs: {mac_list}")
|
log.info(f" Scanning MACs: {mac_list}")
|
||||||
# test_list shrinks with successful tests
|
# test_list shrinks with successful tests
|
||||||
@@ -323,11 +319,13 @@ def test_driver(test_count = 0, bt_usb_id = None):
|
|||||||
# If all the MACs have been scanned, then this test is complete.
|
# If all the MACs have been scanned, then this test is complete.
|
||||||
if len(mac_list) == len(passed_list):
|
if len(mac_list) == len(passed_list):
|
||||||
log.info(f" Test run {test_count} completed, yee-haw")
|
log.info(f" Test run {test_count} completed, yee-haw")
|
||||||
print("Printing sensor results: ")
|
|
||||||
print(sensors)
|
|
||||||
print_sensor_data(sensors)
|
print_sensor_data(sensors)
|
||||||
test_complete = True
|
test_complete = True
|
||||||
return summarize_test_run(sensors, found_macs)
|
result = {
|
||||||
|
"found_macs": found_macs,
|
||||||
|
"sensor_results": sensors
|
||||||
|
}
|
||||||
|
return result
|
||||||
# If not, then re-scan the failed sensors
|
# If not, then re-scan the failed sensors
|
||||||
else:
|
else:
|
||||||
log.warning(f" Test run incomplete/failed, attempt {len(mac_history)} of {reset_retries}, re-running, loop {test_loop_count}. Updating test list.")
|
log.warning(f" Test run incomplete/failed, attempt {len(mac_history)} of {reset_retries}, re-running, loop {test_loop_count}. Updating test list.")
|
||||||
@@ -342,19 +340,6 @@ def test_driver(test_count = 0, bt_usb_id = None):
|
|||||||
# Various other helper functions
|
# Various other helper functions
|
||||||
####################################################
|
####################################################
|
||||||
|
|
||||||
# helper function for summarizing test run results
|
|
||||||
def summarize_test_run(sensors, found_macs):
|
|
||||||
sensor_count = 1
|
|
||||||
for sensor in sensors:
|
|
||||||
print(f"Sensor count: {sensor_count}")
|
|
||||||
log.info(f" {sensor['name']} - Temp: {temp_ctof(sensor['temp'])} | Humidity: {sensor['humidity']}")
|
|
||||||
sensor_count = sensor_count + 1
|
|
||||||
result = {
|
|
||||||
"found_macs": found_macs,
|
|
||||||
"sensor_results": sensors
|
|
||||||
}
|
|
||||||
return result
|
|
||||||
|
|
||||||
# helper function for processing failed tests
|
# helper function for processing failed tests
|
||||||
def get_failed_macs(mac_list, passed_list):
|
def get_failed_macs(mac_list, passed_list):
|
||||||
mac_list_new = []
|
mac_list_new = []
|
||||||
|
|||||||
Reference in new issue
Block a user