fix these tests

pull/33208/head
Shane Smiskol 10 months ago
parent dff4aaac70
commit 134f523174
  1. 7
      selfdrive/car/tests/test_car_interfaces.py
  2. 8
      selfdrive/car/tests/test_models.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

@ -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

Loading…
Cancel
Save