2023-07-22 17:15:58 -07:00
|
|
|
#!/usr/bin/env python3
|
2023-11-07 20:35:44 -05:00
|
|
|
import pytest
|
2023-07-22 17:15:58 -07:00
|
|
|
import time
|
|
|
|
|
import numpy as np
|
|
|
|
|
|
2023-08-20 20:49:55 -07:00
|
|
|
from openpilot.system.hardware.tici.hardware import Tici
|
2023-07-22 17:15:58 -07:00
|
|
|
|
|
|
|
|
HARDWARE = Tici()
|
|
|
|
|
|
2023-11-07 20:35:44 -05:00
|
|
|
|
|
|
|
|
@pytest.mark.tici
|
2024-05-17 11:01:44 -07:00
|
|
|
class TestHardware:
|
2023-07-22 17:15:58 -07:00
|
|
|
|
|
|
|
|
def test_power_save_time(self):
|
|
|
|
|
ts = []
|
|
|
|
|
for _ in range(5):
|
|
|
|
|
for on in (True, False):
|
|
|
|
|
st = time.monotonic()
|
|
|
|
|
HARDWARE.set_power_save(on)
|
|
|
|
|
ts.append(time.monotonic() - st)
|
|
|
|
|
|
2023-08-13 18:01:51 -07:00
|
|
|
assert 0.1 < np.mean(ts) < 0.25
|
2023-07-22 17:15:58 -07:00
|
|
|
assert max(ts) < 0.3
|