Creating a new Test class for a variant of HondaNidecAltSafety causes tests to fail.
AravindaDP opened this issue · 1 comments
AravindaDP commented
Steps to reproduce
Create a Test class for a new variant of HondaNidecAltSafety in tests/safety/test_honda.py as bellow.
Option 1:
Add following just before Honda Bosch Tests
class TestHondaNidecAltBrakeSafety(TestHondaNidecAltSafety):
"""
Covers the Honda Nidec safety mode with alt SCM messages (And later will be extended to include alternate brake message)
"""
Option 2:
Add following just before Honda Bosch Tests
class TestHondaNidecAltBrakeSafety(TestHondaNidecSafety):
"""
Covers the Honda Nidec safety mode with alt SCM messages (And later will be extended to include alternate brake message)
"""
def setUp(self):
self.packer = CANPackerPanda("honda_fit_hybrid_2018_can_generated") # Or "acura_ilx_2016_can_generated" it shouldn't matter
self.safety = libpanda_py.libpanda
self.safety.set_safety_hooks(Panda.SAFETY_HONDA_NIDEC, Panda.FLAG_HONDA_NIDEC_ALT)
self.safety.init_tests()
def _acc_state_msg(self, main_on):
values = {"MAIN_ON": main_on, "COUNTER": self.cnt_acc_state % 4}
self.__class__.cnt_acc_state += 1
return self.packer.make_can_msg_panda("SCM_BUTTONS", self.PT_BUS, values)
def _button_msg(self, buttons, main_on=False, bus=None):
bus = self.PT_BUS if bus is None else bus
values = {"CRUISE_BUTTONS": buttons, "MAIN_ON": main_on, "COUNTER": self.cnt_button % 4}
self.__class__.cnt_button += 1
return self.packer.make_can_msg_panda("SCM_BUTTONS", bus, values)
Actual Result
In either case it results in following test failure
======================================================================
FAIL: test_buttons (test_honda.TestHondaNidecAltSafety.test_buttons)
Buttons should only cancel in this configuration,
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/aravindadp/openpilot/panda/tests/safety/test_honda.py", line 175, in test_buttons
self.assertEqual(controls_allowed, self.safety.get_controls_allowed())
AssertionError: True != False
Expected result
Adding a mere test class like this shouldn't cause any tests to fail.
Note that this is on https://github.com/commaai/panda/tree/5fe1d67b7729c843df7dd15df5d375d08ed410c6 will try to see if this somehow fixed in latest master
AravindaDP commented
It turned out that this issue is fixed in newer panda code. Closing.