mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-11-29 16:23:55 +08:00
Repair CI fixtures after Card and UI changes
This commit is contained in:
@@ -329,7 +329,7 @@ class TestBlendedLifecycle(unittest.TestCase):
|
||||
car._deferred_radar_can = None
|
||||
vars(car)['RI'] = SimpleNamespace(update=lambda can_list: None)
|
||||
vars(car)['state_publish'] = lambda *args: calls.append('state')
|
||||
car.CP = SimpleNamespace(passive=False)
|
||||
car.CP = SimpleNamespace(brand='hyundai', passive=False)
|
||||
car.ci_initialized = False
|
||||
|
||||
class SM(dict):
|
||||
|
||||
@@ -216,7 +216,7 @@ def test_actual_classic_family_cancel_and_manual_withdrawal(identity, monkeypatc
|
||||
config = card.CP.safetyConfigs[0]
|
||||
model, word = int(config.safetyModel.raw), int(config.safetyParam)
|
||||
configured = [False]
|
||||
dispatch_tree = ast.parse(textwrap.dedent(inspect.getsource(card_module.Car.step))).body[0].body
|
||||
dispatch_tree = ast.parse(textwrap.dedent(inspect.getsource(card_module.Car._step))).body[0].body
|
||||
assignments = [node for node in dispatch_tree if isinstance(node, ast.Assign) and
|
||||
any(isinstance(t, ast.Name) and t.id == 'initialized' for t in node.targets)]
|
||||
decisions = [node for node in dispatch_tree if isinstance(node, ast.If) and ast.unparse(node.test) == 'not self.CP.passive and initialized']
|
||||
|
||||
@@ -243,7 +243,7 @@ def test_classic_family_actual_startup_cancel_and_manual_withdrawal(identity, mo
|
||||
config = card.CP.safetyConfigs[0]
|
||||
model, word = int(config.safetyModel.raw), int(config.safetyParam)
|
||||
configured = [False]
|
||||
dispatch_tree = ast.parse(textwrap.dedent(inspect.getsource(card_module.Car.step))).body[0].body
|
||||
dispatch_tree = ast.parse(textwrap.dedent(inspect.getsource(card_module.Car._step))).body[0].body
|
||||
assignments = [
|
||||
node for node in dispatch_tree if isinstance(node, ast.Assign) and any(isinstance(t, ast.Name) and t.id == 'initialized' for t in node.targets)
|
||||
]
|
||||
|
||||
@@ -227,7 +227,7 @@ def test_prepublication_classic_owner_preserves_real_boot_and_independent_axes(i
|
||||
config = card.CP.safetyConfigs[0]
|
||||
model, word = int(config.safetyModel.raw), int(config.safetyParam)
|
||||
configured = [False]
|
||||
dispatch_tree = ast.parse(textwrap.dedent(inspect.getsource(card_module.Car.step))).body[0].body
|
||||
dispatch_tree = ast.parse(textwrap.dedent(inspect.getsource(card_module.Car._step))).body[0].body
|
||||
assignments = [
|
||||
node for node in dispatch_tree if isinstance(node, ast.Assign) and any(isinstance(t, ast.Name) and t.id == 'initialized' for t in node.targets)
|
||||
]
|
||||
|
||||
@@ -27,6 +27,7 @@ def test_all_gm_initializing_steps_keep_servicing_handoff(cp):
|
||||
state_update=Mock(return_value=(cs, None)), state_publish=Mock(),
|
||||
controls_update=Mock(), _deferred_radar_can=None,
|
||||
radar_update=Mock(), radar_publish=Mock())
|
||||
card._step = Car._step.__get__(card)
|
||||
events = [SimpleNamespace(name=1)]
|
||||
card.sm = type('SM', (), {'seen': {'onroadEvents': True}, '__getitem__': lambda _, key: events if key == 'onroadEvents' else None})()
|
||||
for method in ('gm_startup_keepalive', 'volt_startup_keepalive', 'volt_sdgm_startup_keepalive'):
|
||||
|
||||
@@ -148,7 +148,9 @@ class LocalModelManagerHttpTest(unittest.TestCase):
|
||||
self.assertEqual(status, 200)
|
||||
self.assertTrue(laboratory['runtimeSupported'])
|
||||
self.assertFalse(laboratory['runtime']['active'])
|
||||
self.assertEqual(laboratory['summary']['published'], 92)
|
||||
published = {row['value'] for row in laboratory['models'] if row['modelLabArtifactAvailable']}
|
||||
self.assertLessEqual({'gwm8223', 'sc23'}, published)
|
||||
self.assertEqual(laboratory['summary']['published'], len(published))
|
||||
pair = {'enabled': False, 'lateralModel': 'gwm8223', 'longitudinalModel': 'sc23'}
|
||||
self.assertEqual(request('/api/models/laboratory', pair)[0], 200)
|
||||
self.assertEqual(request('/api/models/laboratory', {**pair, 'enabled': True})[0], 409)
|
||||
|
||||
@@ -108,7 +108,7 @@ class TestVehicleStateContext(unittest.TestCase):
|
||||
enable_edge = next(node for node in helper.body[0].body if isinstance(node, ast.If) and initialize in ast.walk(node))
|
||||
self.assertEqual(ast.unparse(enable_edge.test), "self.sm['carControl'].enabled and (not self.CC_prev.enabled)")
|
||||
self.assertIn(initialize, list(ast.walk(enable_edge)))
|
||||
step = inspect.getsource(card.Car.step)
|
||||
step = inspect.getsource(card.Car._step)
|
||||
step_tree = ast.parse(textwrap.dedent(step))
|
||||
state_update = next(node for node in ast.walk(step_tree)
|
||||
if isinstance(node, ast.Call) and ast.unparse(node.func) == 'self.state_update')
|
||||
|
||||
@@ -7,8 +7,12 @@ Reset and migration actions additionally require a parked vehicle.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from openpilot.starpilot.ui.feature_profile_edit import (edit_document, PRESETS as PRESETS,
|
||||
PROFILE_NAMES as PROFILE_NAMES, DOCUMENT_PROFILE_NAMES as DOCUMENT_PROFILE_NAMES)
|
||||
from openpilot.starpilot.ui.feature_profile_edit import (
|
||||
edit_document,
|
||||
PRESETS as PRESETS,
|
||||
PROFILE_NAMES as PROFILE_NAMES,
|
||||
DOCUMENT_PROFILE_NAMES as DOCUMENT_PROFILE_NAMES,
|
||||
)
|
||||
|
||||
from collections.abc import Callable
|
||||
from contextvars import ContextVar
|
||||
@@ -37,9 +41,12 @@ from openpilot.starpilot.longitudinal.profile_document import (
|
||||
personality_reference_curves, serialize_personality_profiles,
|
||||
synchronise_profile_document_enabled,
|
||||
)
|
||||
from openpilot.starpilot.ui.feature_defaults import (AGGRESSIVE_COOLING_DESCRIPTION as AGGRESSIVE_COOLING_DESCRIPTION,
|
||||
AGGRESSIVE_COOLING_KEY as AGGRESSIVE_COOLING_KEY,
|
||||
BOOL_DEFAULTS as BOOL_DEFAULTS, FLOAT_SPECS as FLOAT_SPECS)
|
||||
from openpilot.starpilot.ui.feature_defaults import (
|
||||
AGGRESSIVE_COOLING_DESCRIPTION as AGGRESSIVE_COOLING_DESCRIPTION,
|
||||
AGGRESSIVE_COOLING_KEY as AGGRESSIVE_COOLING_KEY,
|
||||
BOOL_DEFAULTS as BOOL_DEFAULTS,
|
||||
FLOAT_SPECS as FLOAT_SPECS,
|
||||
)
|
||||
from openpilot.starpilot.ui.feature_settings_state import (
|
||||
FeaturePage, FeatureRow, FeatureSettingsRequest, FeatureSettingsState, SettingLevel, SLC_CONFIRM_ACTIONS, SLC_OFFSET_KEYS, TORQUE_CONFIRM_ACTIONS,
|
||||
)
|
||||
@@ -59,8 +66,14 @@ from openpilot.starpilot.ui.controller_feature import ControllerFeature, SETUP_A
|
||||
from openpilot.starpilot.ui.slc_offset_feature import SlcOffsetOwner
|
||||
from openpilot.starpilot.ui.slc_policy_feature import SLC_ADVANCE_CHOICES, policy_rows
|
||||
from openpilot.starpilot.longitudinal.profile_preferences import read_document_value, read_profile_health
|
||||
from openpilot.starpilot.ui.long_profile_feature import (LongProfileFeature, is_long_confirm_action, VALUE_HELP, CATEGORY_HELP,
|
||||
preset_label, preset_value)
|
||||
from openpilot.starpilot.ui.long_profile_feature import (
|
||||
LongProfileFeature,
|
||||
is_long_confirm_action,
|
||||
VALUE_HELP,
|
||||
CATEGORY_HELP,
|
||||
preset_label,
|
||||
preset_value,
|
||||
)
|
||||
from openpilot.starpilot.ui.traffic_feature import TrafficFeature, EDIT_KEYS as TRAFFIC_EDIT_KEYS
|
||||
from openpilot.starpilot.ui.cruise_steps_feature import CRUISE_KEYS, apply_cruise, apply_reverse_cruise, cruise_rows
|
||||
from openpilot.starpilot.ui.lane_change_feature import LaneChangeFeature, KEYS as LANE_CHANGE_KEYS
|
||||
@@ -87,8 +100,6 @@ from openpilot.starpilot.curve_speed.preferences import (
|
||||
DOCUMENT_LIMIT as CURVE_DOCUMENT_LIMIT, read_learning,
|
||||
)
|
||||
from openpilot.starpilot.curve_speed.actions import ACTION_KEYS as CURVE_ACTION_KEYS, apply_learning, learning_snapshot
|
||||
|
||||
|
||||
from openpilot.starpilot.controllers.toyota_cruise import capability as toyota_cruise_capability
|
||||
|
||||
|
||||
@@ -164,8 +175,8 @@ class FeatureSettingsOwner:
|
||||
self.volt_radar = VoltRadarFeature(self, galaxy=galaxy)
|
||||
self.panda_wake = PandaWakeFeature(self, galaxy=galaxy)
|
||||
self.traffic_profiles = TrafficFeature(self)
|
||||
self.lane_changes = LaneChangeFeature(params, authority, vehicle_fingerprint, self.vehicle_params,
|
||||
configuration_longitudinal=self.configuration_longitudinal)
|
||||
self.lane_changes = LaneChangeFeature(
|
||||
params, authority, vehicle_fingerprint, self.vehicle_params, configuration_longitudinal=self.configuration_longitudinal)
|
||||
self.conditional = ConditionalFeature(self)
|
||||
self.wheel = TeslaWheelRows(self)
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ def test_native_chestnut_status_accepts_typed_params(raw, expected, tmp_path):
|
||||
params.get_param_path.side_effect = lambda key: str(tmp_path / key)
|
||||
params.get.return_value = raw
|
||||
params.get_bool.return_value = False
|
||||
state = Mock(spec=UIState, params=params, started=True, chestnut_compiled=True, usb_connected=False)
|
||||
state = Mock(spec=UIState, params=params, started=True, chestnut_compiled=True, usb_connected=False, _gpu_artifacts=None)
|
||||
with patch('openpilot.selfdrive.ui.ui_state.get_cache', return_value=None), \
|
||||
patch('openpilot.selfdrive.ui.ui_state.cable_connected', return_value=False):
|
||||
UIState.update_params(state)
|
||||
|
||||
@@ -505,14 +505,14 @@ class NativeSettingsPageTests(unittest.TestCase):
|
||||
# Run the real controller methods with only device services isolated.
|
||||
source = Path('openpilot/selfdrive/ui/layouts/settings/toggles.py')
|
||||
layout = next(node for node in ast.parse(source.read_text()).body if isinstance(node, ast.ClassDef) and node.name == 'TogglesLayout')
|
||||
methods = {'_update_toggles', '_update_state', '_toggle_callback',
|
||||
methods = {'_update_toggles', '_update_state', '_toggle_callback', '_toggle_action',
|
||||
'request_toggle', 'request_personality', '_set_longitudinal_personality'}
|
||||
layout.bases = []
|
||||
layout.body = [node for node in layout.body if isinstance(node, ast.FunctionDef) and node.name in methods]
|
||||
ui = NS(CP=None, engaged=False, parked=True, update_params=Mock(), sm=NS(updated={'selfdriveState': False}))
|
||||
app = NS(push_widget=Mock())
|
||||
namespace = ModuleType('toggles_controller_test')
|
||||
namespace.__dict__.update(tr=lambda text: text, ui_state=ui)
|
||||
namespace.__dict__.update(tr=lambda text: text, ui_state=ui, ToggleAction=ToggleAction)
|
||||
exec(compile(ast.Module(body=[layout], type_ignores=[]), str(source), 'exec'), namespace.__dict__)
|
||||
owner = namespace.TogglesLayout()
|
||||
class SavedParams(Params):
|
||||
|
||||
@@ -158,6 +158,7 @@ def test_actual_c4_startup_redirect_only_yields_to_fresh_open_parked_game(monkey
|
||||
owner._prev_onroad, owner._prev_standstill = True, True
|
||||
owner._onroad_time_delay = 5.
|
||||
owner._onboarding_window = Mock()
|
||||
owner._home_layout = Mock()
|
||||
page = object.__new__(native.SpacePilotPage)
|
||||
page.closed = condition == 'closed'
|
||||
page.session = Mock(stage=native.Stage.CLOSED if page.closed else native.Stage.VERIFYING)
|
||||
|
||||
@@ -112,7 +112,7 @@ def test_renderer_dispatches_each_widget_in_saved_order(profile, viewport):
|
||||
method = next(node for node in ast.walk(tree) if isinstance(node, ast.FunctionDef) and node.name == '_ordered_widgets')
|
||||
namespace: dict[str, Any] = {'CLOCK_WIDGET': CLOCK_WIDGET, 'MODE_WIDGET': MODE_WIDGET, 'placement': placement, 'widget_order': widget_order,
|
||||
'RAIL_WIDGETS': RAIL_WIDGETS, 'STOPPED_TIMER_WIDGET': STOPPED_TIMER_WIDGET,
|
||||
'render_rear_fog': lambda *args: seen.append('rear_fog'),
|
||||
'render_rear_fog': lambda *args: seen.append('rear_fog'), 'compact_wheel_warning': lambda state: False,
|
||||
'manual_slc_confirmation': lambda profile, state: False, 'AlertSize': NS(NONE='none', FULL='full'), 'CameraViewChoice': NS(NONE='none'),
|
||||
'rl': NS(Rectangle=lambda x, y, width, height: NS(x=x, y=y, width=width, height=height))}
|
||||
exec(compile(ast.Module(body=[method], type_ignores=[]), str(source), 'exec'), namespace)
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"protected_inventory_sha256": "f3801b032f033ab7d96e20097ad6b98e749424787d0f655095a6ba2b7e68b40f", "schema_version": 1}
|
||||
{"protected_inventory_sha256": "47869c49a5ca66ab4b8ce2e706f5b1f864b6fbf767cbf9342d57a9f1f443d453", "schema_version": 1}
|
||||
|
||||
Reference in New Issue
Block a user