From 134f523174c90eadd7a72c55c09ebb79cc37b1bd Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Tue, 13 Aug 2024 23:45:39 -0700 Subject: [PATCH] fix these tests --- selfdrive/car/tests/test_car_interfaces.py | 7 +++++-- selfdrive/car/tests/test_models.py | 8 ++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/selfdrive/car/tests/test_car_interfaces.py b/selfdrive/car/tests/test_car_interfaces.py index 96028cee00..789241a420 100644 --- a/selfdrive/car/tests/test_car_interfaces.py +++ b/selfdrive/car/tests/test_car_interfaces.py @@ -7,6 +7,7 @@ from parameterized import parameterized from cereal import car, messaging from openpilot.selfdrive.car import DT_CTRL, gen_empty_fingerprint +from openpilot.selfdrive.car.card import convert_carControl from openpilot.selfdrive.car.car_helpers import interfaces from openpilot.selfdrive.car.structs import CarParams from openpilot.selfdrive.car.fingerprints import all_known_cars @@ -97,16 +98,18 @@ class TestCarInterfaces: # Run car interface now_nanos = 0 CC = car.CarControl.new_message(**cc_msg) + CC = convert_carControl(CC.as_reader()) for _ in range(10): car_interface.update([]) - car_interface.apply(CC.as_reader(), now_nanos) + car_interface.apply(CC, now_nanos) now_nanos += DT_CTRL * 1e9 # 10 ms CC = car.CarControl.new_message(**cc_msg) CC.enabled = True + CC = convert_carControl(CC.as_reader()) for _ in range(10): car_interface.update([]) - car_interface.apply(CC.as_reader(), now_nanos) + car_interface.apply(CC, now_nanos) now_nanos += DT_CTRL * 1e9 # 10ms # Test controller initialization diff --git a/selfdrive/car/tests/test_models.py b/selfdrive/car/tests/test_models.py index 91006007e3..a668c792d6 100644 --- a/selfdrive/car/tests/test_models.py +++ b/selfdrive/car/tests/test_models.py @@ -21,7 +21,7 @@ from openpilot.selfdrive.car.car_helpers import FRAME_FINGERPRINT, interfaces from openpilot.selfdrive.car.honda.values import CAR as HONDA, HondaFlags from openpilot.selfdrive.car.tests.routes import non_tested_cars, routes, CarTestRoute from openpilot.selfdrive.car.values import Platform -from openpilot.selfdrive.car.card import Car +from openpilot.selfdrive.car.card import Car, convert_carControl from openpilot.selfdrive.pandad import can_capnp_to_list from openpilot.selfdrive.test.helpers import read_segment_list from openpilot.system.hardware.hw import DEFAULT_DOWNLOAD_CACHE_ROOT @@ -310,17 +310,17 @@ class TestCarModelBase(unittest.TestCase): # Make sure we can send all messages while inactive CC = car.CarControl.new_message() - test_car_controller(CC.as_reader()) + test_car_controller(convert_carControl(CC.as_reader())) # Test cancel + general messages (controls_allowed=False & cruise_engaged=True) self.safety.set_cruise_engaged_prev(True) CC = car.CarControl.new_message(cruiseControl={'cancel': True}) - test_car_controller(CC.as_reader()) + test_car_controller(convert_carControl(CC.as_reader())) # Test resume + general messages (controls_allowed=True & cruise_engaged=True) self.safety.set_controls_allowed(True) CC = car.CarControl.new_message(cruiseControl={'resume': True}) - test_car_controller(CC.as_reader()) + test_car_controller(convert_carControl(CC.as_reader())) # Skip stdout/stderr capture with pytest, causes elevated memory usage @pytest.mark.nocapture