mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-02-18 22:23:56 +08:00
CI: run unittests in parallel with xdist (#29756)
* parallel tests
* review suggesions
* add to pyproject
* add a bit more buffer on that
* fix rare athena issue
* remove from pypoetry
old-commit-hash: dde225221e
This commit is contained in:
2
.github/workflows/selfdrive_tests.yaml
vendored
2
.github/workflows/selfdrive_tests.yaml
vendored
@@ -249,7 +249,7 @@ jobs:
|
||||
timeout-minutes: 40
|
||||
run: |
|
||||
${{ env.RUN }} "export SKIP_LONG_TESTS=1 && \
|
||||
$PYTEST && \
|
||||
$PYTEST -n auto --dist=loadscope && \
|
||||
selfdrive/locationd/test/_test_locationd_lib.py && \
|
||||
./system/ubloxd/tests/test_glonass_runner && \
|
||||
./selfdrive/ui/tests/create_test_translations.sh && \
|
||||
|
||||
@@ -119,12 +119,11 @@ class AbortTransferException(Exception):
|
||||
|
||||
|
||||
class UploadQueueCache:
|
||||
params = Params()
|
||||
|
||||
@staticmethod
|
||||
def initialize(upload_queue: Queue[UploadItem]) -> None:
|
||||
try:
|
||||
upload_queue_json = UploadQueueCache.params.get("AthenadUploadQueue")
|
||||
upload_queue_json = Params().get("AthenadUploadQueue")
|
||||
if upload_queue_json is not None:
|
||||
for item in json.loads(upload_queue_json):
|
||||
upload_queue.put(UploadItem.from_dict(item))
|
||||
@@ -136,7 +135,7 @@ class UploadQueueCache:
|
||||
try:
|
||||
queue: List[Optional[UploadItem]] = list(upload_queue.queue)
|
||||
items = [asdict(i) for i in queue if i is not None and (i.id not in cancelled_uploads)]
|
||||
UploadQueueCache.params.put("AthenadUploadQueue", json.dumps(items))
|
||||
Params().put("AthenadUploadQueue", json.dumps(items))
|
||||
except Exception:
|
||||
cloudlog.exception("athena.UploadQueueCache.cache.exception")
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ ABOVE_LIMITS_CARS = [
|
||||
car_model_jerks: DefaultDict[str, Dict[str, float]] = defaultdict(dict)
|
||||
|
||||
|
||||
@parameterized_class('car_model', [(c,) for c in CAR_MODELS])
|
||||
@parameterized_class('car_model', [(c,) for c in sorted(CAR_MODELS)])
|
||||
class TestLateralLimits(unittest.TestCase):
|
||||
car_model: str
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
import itertools
|
||||
import numpy as np
|
||||
import unittest
|
||||
|
||||
@@ -31,21 +32,19 @@ def run_cruise_simulation(cruise, e2e, t_end=20.):
|
||||
return output[-1, 3]
|
||||
|
||||
|
||||
@parameterized_class(("e2e", "personality", "speed"), itertools.product(
|
||||
[True, False], # e2e
|
||||
log.LongitudinalPersonality.schema.enumerants, # personality
|
||||
[5,35])) # speed
|
||||
class TestCruiseSpeed(unittest.TestCase):
|
||||
def test_cruise_speed(self):
|
||||
params = Params()
|
||||
personalities = [log.LongitudinalPersonality.relaxed,
|
||||
log.LongitudinalPersonality.standard,
|
||||
log.LongitudinalPersonality.aggressive]
|
||||
for personality in personalities:
|
||||
params.put("LongitudinalPersonality", str(personality))
|
||||
for e2e in [False, True]:
|
||||
for speed in [5,35]:
|
||||
print(f'Testing {speed} m/s')
|
||||
cruise_speed = float(speed)
|
||||
params.put("LongitudinalPersonality", str(self.personality))
|
||||
print(f'Testing {self.speed} m/s')
|
||||
cruise_speed = float(self.speed)
|
||||
|
||||
simulation_steady_state = run_cruise_simulation(cruise_speed, e2e)
|
||||
self.assertAlmostEqual(simulation_steady_state, cruise_speed, delta=.01, msg=f'Did not reach {speed} m/s')
|
||||
simulation_steady_state = run_cruise_simulation(cruise_speed, self.e2e)
|
||||
self.assertAlmostEqual(simulation_steady_state, cruise_speed, delta=.01, msg=f'Did not reach {self.speed} m/s')
|
||||
|
||||
|
||||
# TODO: test pcmCruise
|
||||
|
||||
@@ -21,7 +21,7 @@ class TestLogmessaged(unittest.TestCase):
|
||||
self.error_sock = messaging.sub_sock("logMessage", timeout=1000, conflate=False)
|
||||
|
||||
# ensure sockets are connected
|
||||
time.sleep(0.2)
|
||||
time.sleep(1)
|
||||
messaging.drain_sock(self.sock)
|
||||
messaging.drain_sock(self.error_sock)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user