maybe fix test summary
This commit is contained in:
1 parent
5c00f02c55
commit
5a6ebadd3f
1 file changed
+44
-6
+44
-6
@@ -287,7 +287,7 @@ def test(test_count = 0) -> None:
|
|||||||
log.warning(f" Test run incomplete/failed, re-running, loop {test_loop_count}. Updating test list")
|
log.warning(f" Test run incomplete/failed, re-running, loop {test_loop_count}. Updating test list")
|
||||||
for sensor in sensors:
|
for sensor in sensors:
|
||||||
temp_f = (sensor['temp'] * 1.80) + 32.0
|
temp_f = (sensor['temp'] * 1.80) + 32.0
|
||||||
log.warning(f" {sensor['name']} - Temp: {round(temp_f,1)} | Humidity: {sensor['humidity']}")
|
log.info(f" {sensor['name']} - Temp: {round(temp_f,1)} | Humidity: {sensor['humidity']}")
|
||||||
mac_list_new = []
|
mac_list_new = []
|
||||||
for mac in mac_list:
|
for mac in mac_list:
|
||||||
if mac not in passed_list:
|
if mac not in passed_list:
|
||||||
@@ -334,11 +334,11 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
log.info("Test run completed")
|
log.info("Test run completed")
|
||||||
for test_result in test_results:
|
for test_result in test_results:
|
||||||
log.info(f"Test {test_result['test_label']}:")
|
log.info(test_result['test_label'])
|
||||||
parts: List[str] = []
|
parts: List[str] = []
|
||||||
for reading in test_result['test_result']:
|
for reading in test_result['test_result']['sensor_results']:
|
||||||
mac = reading.get("name", "")
|
mac = reading['name']
|
||||||
temp = reading.get("temp", 0)
|
temp = reading['temp']
|
||||||
# Grab the last two octets of the MAC address
|
# Grab the last two octets of the MAC address
|
||||||
octets = mac.split(":")[-2:]
|
octets = mac.split(":")[-2:]
|
||||||
short_mac = ":".join(octets)
|
short_mac = ":".join(octets)
|
||||||
@@ -346,6 +346,44 @@ if __name__ == "__main__":
|
|||||||
result_summary = " | ".join(parts)
|
result_summary = " | ".join(parts)
|
||||||
log.info(result_summary)
|
log.info(result_summary)
|
||||||
|
|
||||||
# Insert before the main guard
|
# This is the structure of test_results
|
||||||
|
# [
|
||||||
|
# {
|
||||||
|
# "test_label": test_label,
|
||||||
|
# "test_result": {
|
||||||
|
# "found_macs": found_macs,
|
||||||
|
# "sensor_results": [
|
||||||
|
# {
|
||||||
|
# "name": mac,
|
||||||
|
# "temp": this_result.temperature,
|
||||||
|
# "humidity": this_result.humidity
|
||||||
|
# },
|
||||||
|
# {
|
||||||
|
# "name": mac,
|
||||||
|
# "temp": this_result.temperature,
|
||||||
|
# "humidity": this_result.humidity
|
||||||
|
# }
|
||||||
|
# ]
|
||||||
|
# }
|
||||||
|
# },
|
||||||
|
# {
|
||||||
|
# "test_label": test_label,
|
||||||
|
# "test_result": {
|
||||||
|
# "found_macs": found_macs,
|
||||||
|
# "sensor_results": [
|
||||||
|
# {
|
||||||
|
# "name": mac,
|
||||||
|
# "temp": this_result.temperature,
|
||||||
|
# "humidity": this_result.humidity
|
||||||
|
# },
|
||||||
|
# {
|
||||||
|
# "name": mac,
|
||||||
|
# "temp": this_result.temperature,
|
||||||
|
# "humidity": this_result.humidity
|
||||||
|
# }
|
||||||
|
# ]
|
||||||
|
# }
|
||||||
|
# }
|
||||||
|
# ]
|
||||||
|
|
||||||
|
|
||||||
Reference in new issue
Block a user