test_power_draw: add header to output table (#27511)
* test_power_draw: add header to output table * units old-commit-hash: ebd25b8a7de29542be7c6a213c578bc363999857
This commit is contained in:
BIN
poetry.lock
LFS
generated
BIN
poetry.lock
LFS
generated
Binary file not shown.
@@ -59,6 +59,7 @@ urllib3 = "^1.26.10"
|
||||
utm = "^0.7.0"
|
||||
websocket_client = "^1.3.3"
|
||||
polyline = "^1.4.0"
|
||||
types-tabulate = "^0.9.0.1"
|
||||
|
||||
|
||||
[tool.poetry.group.dev.dependencies]
|
||||
|
||||
@@ -3,6 +3,7 @@ import unittest
|
||||
import time
|
||||
import math
|
||||
from dataclasses import dataclass
|
||||
from tabulate import tabulate
|
||||
|
||||
from system.hardware import HARDWARE, TICI
|
||||
from system.hardware.tici.power_monitor import get_power
|
||||
@@ -58,15 +59,16 @@ class TestPowerDraw(unittest.TestCase):
|
||||
|
||||
manager_cleanup()
|
||||
|
||||
print("-"*35)
|
||||
print(f"Baseline {baseline:.2f}W\n")
|
||||
tab = []
|
||||
tab.append(['process', 'expected (W)', 'current (W)'])
|
||||
for proc in PROCS:
|
||||
cur = used[proc.name]
|
||||
expected = proc.power
|
||||
print(f"{proc.name.ljust(20)} {expected:.2f}W {cur:.2f}W")
|
||||
tab.append([proc.name, round(expected, 2), round(cur, 2)])
|
||||
with self.subTest(proc=proc.name):
|
||||
self.assertTrue(math.isclose(cur, expected, rel_tol=proc.rtol, abs_tol=proc.atol))
|
||||
print("-"*35)
|
||||
print(tabulate(tab))
|
||||
print(f"Baseline {baseline:.2f}W\n")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user