mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-06-28 18:12:05 +08:00
3027a428cb
* mark tici * not those ones * missed that one * add those * add pypoetry * oops old-commit-hash: aec7cea30d48dc8915eea38c86de7d4effa0548d
34 lines
646 B
Python
Executable File
34 lines
646 B
Python
Executable File
#!/usr/bin/env python3
|
|
import pytest
|
|
import time
|
|
import unittest
|
|
import numpy as np
|
|
|
|
from openpilot.system.hardware.tici.hardware import Tici
|
|
|
|
HARDWARE = Tici()
|
|
|
|
|
|
@pytest.mark.tici
|
|
class TestHardware(unittest.TestCase):
|
|
|
|
@classmethod
|
|
def setUpClass(cls):
|
|
HARDWARE.initialize_hardware()
|
|
HARDWARE.set_power_save(False)
|
|
|
|
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
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|