diff --git a/selfdrive/controls/tests/test_state_machine.py b/selfdrive/controls/tests/test_state_machine.py index bdeed9fb7a..a05934ca90 100755 --- a/selfdrive/controls/tests/test_state_machine.py +++ b/selfdrive/controls/tests/test_state_machine.py @@ -1,15 +1,17 @@ #!/usr/bin/env python3 import unittest +from unittest import mock from cereal import car, log from openpilot.common.realtime import DT_CTRL from openpilot.selfdrive.car.car_helpers import interfaces from openpilot.selfdrive.controls.controlsd import Controls, SOFT_DISABLE_TIME from openpilot.selfdrive.controls.lib.events import Events, ET, Alert, Priority, AlertSize, AlertStatus, VisualAlert, \ - AudibleAlert, EVENTS + AudibleAlert, EVENTS as _EVENTS State = log.ControlsState.OpenpilotState +EVENTS = _EVENTS.copy() # The event types that maintain the current state MAINTAIN_STATES = {State.enabled: (None,), State.disabled: (None,), State.softDisabling: (ET.SOFT_DISABLE,), State.preEnabled: (ET.PRE_ENABLE,), State.overriding: (ET.OVERRIDE_LATERAL, ET.OVERRIDE_LONGITUDINAL)} @@ -27,6 +29,7 @@ def make_event(event_types): return 0 +@mock.patch("openpilot.selfdrive.controls.lib.events.EVENTS", EVENTS) class TestStateMachine(unittest.TestCase): def setUp(self):