Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
better test logging
Browse files Browse the repository at this point in the history
flxdot committed Apr 18, 2024
1 parent 69a9b31 commit 2b3771a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion services/device/device/cli/config.py
Original file line number Diff line number Diff line change
@@ -65,16 +65,23 @@ def test(): # pragma: no cover
"""Tests the io peripherals."""

exceptions = {}
results = {}
for io in IoManager().setup().ios:
console.log(f"[blue]Testing {io} ... ", end="")
try:
result = io.test()
console.log("[green]passed")
console.log(result)
if result:
results[io.identifier] = result
except Exception as e:
console.log("[red]failed")
exceptions[io.identifier] = e

if results:
console.log("\n[blue]The following IO peripherals returned data:")
for identifier, result in results.items():
console.log(f"[blue]{identifier}: {result}")

if exceptions:
console.log("\n[red]The following IO peripherals failed:")
for identifier, exception in exceptions.items():

0 comments on commit 2b3771a

Please sign in to comment.