mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-02-21 00:13:53 +08:00
* add pytest-asyncio * switch common * switch selfdrive * switch system * switch tools * small fixes * fix setUp and valgrind pytest * switch to setup * fix random * switch mock * switch test_lateral_limits * revert test_ui * fix poetry.lock * add unittest to banned-api * add inline ignores to remaining unittest imports * revert test_models * revert check_can_parser_performance * one more skip --------- Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
24 lines
455 B
Python
Executable File
24 lines
455 B
Python
Executable File
#!/usr/bin/env python3
|
|
import pytest
|
|
import time
|
|
import numpy as np
|
|
|
|
from openpilot.system.hardware.tici.hardware import Tici
|
|
|
|
HARDWARE = Tici()
|
|
|
|
|
|
@pytest.mark.tici
|
|
class TestHardware:
|
|
|
|
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)
|
|
|
|
assert 0.1 < np.mean(ts) < 0.25
|
|
assert max(ts) < 0.3
|