From a4745aa158c1136166d581cee76d37931c1a8022 Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Sun, 9 Jun 2024 11:51:43 -0700 Subject: [PATCH] tici: improve power save test (#32674) * tici: improve power save test * Update system/hardware/tici/tests/test_hardware.py old-commit-hash: da1cb2276bf28ee906e61a717da2e2699bdba34d --- system/hardware/tici/tests/test_hardware.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/system/hardware/tici/tests/test_hardware.py b/system/hardware/tici/tests/test_hardware.py index 30eed7e0d..75f53e7cd 100644 --- a/system/hardware/tici/tests/test_hardware.py +++ b/system/hardware/tici/tests/test_hardware.py @@ -11,12 +11,16 @@ HARDWARE = Tici() class TestHardware: def test_power_save_time(self): - ts = [] + ts = {True: [], False: []} for _ in range(5): for on in (True, False): st = time.monotonic() HARDWARE.set_power_save(on) - ts.append(time.monotonic() - st) + ts[on].append(time.monotonic() - st) - assert 0.1 < np.mean(ts) < 0.25 - assert max(ts) < 0.3 + # disabling power save is the main time-critical one + 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