mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-07-01 19:42:07 +08:00
test_models: use opendbc CanData (#34546)
* replace with non-messaging CanData * clean up
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import time
|
||||
import capnp
|
||||
import os
|
||||
import pytest
|
||||
@@ -9,11 +10,12 @@ import hypothesis.strategies as st
|
||||
from hypothesis import Phase, given, settings
|
||||
from parameterized import parameterized_class
|
||||
|
||||
from cereal import messaging, log, car
|
||||
from cereal import log, car
|
||||
from openpilot.common.basedir import BASEDIR
|
||||
from opendbc.car import DT_CTRL, gen_empty_fingerprint, structs
|
||||
from opendbc.car.fingerprints import all_known_cars, MIGRATION
|
||||
from opendbc.car.can_definitions import CanData
|
||||
from opendbc.car.car_helpers import FRAME_FINGERPRINT, interfaces
|
||||
from opendbc.car.fingerprints import all_known_cars, MIGRATION
|
||||
from opendbc.car.honda.values import CAR as HONDA, HondaFlags
|
||||
from opendbc.car.values import Platform
|
||||
from opendbc.car.tests.routes import non_tested_cars, routes, CarTestRoute
|
||||
@@ -335,10 +337,8 @@ class TestCarModelBase(unittest.TestCase):
|
||||
to_send = libpanda_py.make_CANPacket(address, bus, dat)
|
||||
self.safety.safety_rx_hook(to_send)
|
||||
|
||||
can = messaging.new_message('can', 1)
|
||||
can.can = [log.CanData(address=address, dat=dat, src=bus)]
|
||||
|
||||
CS = self.CI.update(can_capnp_to_list((can.to_bytes(),)))
|
||||
can = [(int(time.monotonic() * 1e9), [CanData(address=address, dat=dat, src=bus)])]
|
||||
CS = self.CI.update(can)
|
||||
|
||||
if self.safety.get_gas_pressed_prev() != prev_panda_gas:
|
||||
self.assertEqual(CS.gasPressed, self.safety.get_gas_pressed_prev())
|
||||
|
||||
Reference in New Issue
Block a user