From 9ad1f096bfca3712320f19b1b49aa9e6ac9b68e4 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Tue, 3 Sep 2024 15:51:59 -0700 Subject: [PATCH] interfaces returns radarinterface --- selfdrive/car/tests/test_car_interfaces.py | 2 +- selfdrive/car/tests/test_models.py | 6 ++---- selfdrive/controls/lib/tests/test_latcontrol.py | 2 +- selfdrive/controls/tests/test_state_machine.py | 2 +- selfdrive/test/process_replay/process_replay.py | 2 +- 5 files changed, 6 insertions(+), 8 deletions(-) diff --git a/selfdrive/car/tests/test_car_interfaces.py b/selfdrive/car/tests/test_car_interfaces.py index f2a60c4d10cca9..66cf0dc6968531 100644 --- a/selfdrive/car/tests/test_car_interfaces.py +++ b/selfdrive/car/tests/test_car_interfaces.py @@ -35,7 +35,7 @@ class TestCarInterfaces: phases=(Phase.reuse, Phase.generate, Phase.shrink)) @given(data=st.data()) def test_car_interfaces(self, car_name, data): - CarInterface, CarController, CarState = interfaces[car_name] + CarInterface, CarController, CarState, RadarInterface = interfaces[car_name] args = get_fuzzy_car_interface_args(data.draw) diff --git a/selfdrive/car/tests/test_models.py b/selfdrive/car/tests/test_models.py index 25db426d234e0b..b0bd24c33f2e57 100644 --- a/selfdrive/car/tests/test_models.py +++ b/selfdrive/car/tests/test_models.py @@ -2,7 +2,6 @@ import copy import dataclasses import os -import importlib import pytest import random import unittest # noqa: TID251 @@ -171,7 +170,7 @@ def setUpClass(cls): cls.can_msgs = sorted(can_msgs, key=lambda msg: msg.logMonoTime) - cls.CarInterface, cls.CarController, cls.CarState = interfaces[cls.platform] + cls.CarInterface, cls.CarController, cls.CarState, cls.RadarInterface = interfaces[cls.platform] cls.CP = cls.CarInterface.get_params(cls.platform, cls.fingerprint, car_fw, experimental_long, docs=False) assert cls.CP assert cls.CP.carFingerprint == cls.platform @@ -232,8 +231,7 @@ def test_car_interface(self): self.assertEqual(can_invalid_cnt, 0) def test_radar_interface(self): - RadarInterface = importlib.import_module(f'opendbc.car.{self.CP.carName}.radar_interface').RadarInterface - RI = RadarInterface(self.CP) + RI = self.RadarInterface(self.CP) assert RI # Since OBD port is multiplexed to bus 1 (commonly radar bus) while fingerprinting, diff --git a/selfdrive/controls/lib/tests/test_latcontrol.py b/selfdrive/controls/lib/tests/test_latcontrol.py index c3847ed1a5c9c7..c8c8d027515bb1 100644 --- a/selfdrive/controls/lib/tests/test_latcontrol.py +++ b/selfdrive/controls/lib/tests/test_latcontrol.py @@ -18,7 +18,7 @@ class TestLatControl: @parameterized.expand([(HONDA.HONDA_CIVIC, LatControlPID), (TOYOTA.TOYOTA_RAV4, LatControlTorque), (NISSAN.NISSAN_LEAF, LatControlAngle)]) def test_saturation(self, car_name, controller): - CarInterface, CarController, CarState = interfaces[car_name] + CarInterface, CarController, CarState, RadarInterface = interfaces[car_name] CP = CarInterface.get_non_essential_params(car_name) CI = CarInterface(CP, CarController, CarState) CP = convert_to_capnp(CP) diff --git a/selfdrive/controls/tests/test_state_machine.py b/selfdrive/controls/tests/test_state_machine.py index 3926b88eb27382..a42cd6056bdeb2 100644 --- a/selfdrive/controls/tests/test_state_machine.py +++ b/selfdrive/controls/tests/test_state_machine.py @@ -28,7 +28,7 @@ def make_event(event_types): class TestStateMachine: def setup_method(self): - CarInterface, CarController, CarState = interfaces[MOCK.MOCK] + CarInterface, CarController, CarState, RadarInterface = interfaces[MOCK.MOCK] CP = CarInterface.get_non_essential_params(MOCK.MOCK) CI = CarInterface(CP, CarController, CarState) diff --git a/selfdrive/test/process_replay/process_replay.py b/selfdrive/test/process_replay/process_replay.py index 5dc585ffe78d70..9491cb9370971e 100755 --- a/selfdrive/test/process_replay/process_replay.py +++ b/selfdrive/test/process_replay/process_replay.py @@ -343,7 +343,7 @@ def card_fingerprint_callback(rc, pm, msgs, fingerprint): def get_car_params_callback(rc, pm, msgs, fingerprint): params = Params() if fingerprint: - CarInterface, _, _ = interfaces[fingerprint] + CarInterface, _, _, _ = interfaces[fingerprint] CP = CarInterface.get_non_essential_params(fingerprint) else: can = DummySocket()