tici: improve power save test (#32674)

* tici: improve power save test

* Update system/hardware/tici/tests/test_hardware.py
pull/32675/head
Adeeb Shihadeh 11 months ago committed by GitHub
parent 2cfb4df82c
commit da1cb2276b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 12
      system/hardware/tici/tests/test_hardware.py

@ -11,12 +11,16 @@ HARDWARE = Tici()
class TestHardware: class TestHardware:
def test_power_save_time(self): def test_power_save_time(self):
ts = [] ts = {True: [], False: []}
for _ in range(5): for _ in range(5):
for on in (True, False): for on in (True, False):
st = time.monotonic() st = time.monotonic()
HARDWARE.set_power_save(on) HARDWARE.set_power_save(on)
ts.append(time.monotonic() - st) ts[on].append(time.monotonic() - st)
assert 0.1 < np.mean(ts) < 0.25 # disabling power save is the main time-critical one
assert max(ts) < 0.3 assert 0.1 < np.mean(ts[False]) < 0.15
assert max(ts[False]) < 0.2
assert 0.1 < np.mean(ts[True]) < 0.35
assert max(ts[True]) < 0.4

Loading…
Cancel
Save