mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-11-06 20:43:46 +08:00
test: complete default metadata lookup in remaining preference fixtures
Delegate the isolated Ioniq5PE, Toyota shell and GM pitch mock default lookups to real Params metadata. Preserve existing assertions, no-setting-write checks and runtime behavior.
This commit is contained in:
@@ -482,6 +482,7 @@ class TestPENormalSelection(unittest.TestCase):
|
||||
from opendbc.car.car_helpers import get_car
|
||||
from opendbc.car.vin import VIN_UNKNOWN
|
||||
from opendbc.car.hyundai.tests.test_ioniq5pe_2027 import FIXTURE, firmware
|
||||
from openpilot.common.params import Params
|
||||
from openpilot.selfdrive.car.card import alpha_long_requested
|
||||
from openpilot.starpilot.vehicle_preferences import VehicleStartupPreferences
|
||||
from openpilot.starpilot.vehicle_startup import VehicleStartupOwner
|
||||
@@ -499,6 +500,9 @@ class TestPENormalSelection(unittest.TestCase):
|
||||
for key, value in self.values.items():
|
||||
(self.root / key).write_bytes(value)
|
||||
|
||||
def get_default_value(self, key):
|
||||
return Params().get_default_value(key)
|
||||
|
||||
def get_param_path(self, key):
|
||||
return str(self.root / key)
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ from opendbc.car import gen_empty_fingerprint
|
||||
from opendbc.car.toyota.interface import CarInterface, toyota_auto_hold_supported
|
||||
from opendbc.car.toyota.radar_interface import RadarInterface
|
||||
from opendbc.car.toyota.values import CAR
|
||||
from openpilot.common.params import Params
|
||||
from openpilot.starpilot.ui import runtime_app
|
||||
from openpilot.starpilot.ui.feature_settings_owner import FeatureSettingsOwner
|
||||
from openpilot.starpilot.ui.feature_settings_state import FeaturePage, row_change
|
||||
@@ -18,6 +19,9 @@ class FilesystemParams:
|
||||
def __init__(self, path):
|
||||
self.path = path
|
||||
|
||||
def get_default_value(self, key):
|
||||
return Params().get_default_value(key)
|
||||
|
||||
def get_param_path(self, key):
|
||||
return str(self.path / key)
|
||||
|
||||
|
||||
@@ -7,13 +7,15 @@ import unittest
|
||||
from opendbc.car.gm.tests.test_ascm_intercept import params
|
||||
from opendbc.car import structs
|
||||
from opendbc.car.gm.values import CAR, PEDAL_BOLT_CAR
|
||||
from openpilot.common.params import Params
|
||||
from openpilot.starpilot.vehicle_preferences import VehicleStartupPreferences
|
||||
|
||||
|
||||
class TestGMPitchPreferences(unittest.TestCase):
|
||||
def test_exact_off_and_default_on(self):
|
||||
with tempfile.TemporaryDirectory() as root:
|
||||
source = SimpleNamespace(get_param_path=lambda key: str(Path(root) / key))
|
||||
source = SimpleNamespace(get_param_path=lambda key: str(Path(root) / key),
|
||||
get_default_value=Params().get_default_value)
|
||||
for raw in (None, b'0', b'1', b'', b'false', b'0\n', b'0' * 20):
|
||||
path = Path(root) / 'LongPitch'
|
||||
path.unlink(missing_ok=True)
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"protected_inventory_sha256": "1d1ba61d19622cec24db89557681495ff4c3743205d975e95c8a12607e592957", "schema_version": 1}
|
||||
{"protected_inventory_sha256": "40521b42a0a738ed0346b641a0419b8e172f0760fd6889f3f7974318775933ca", "schema_version": 1}
|
||||
|
||||
Reference in New Issue
Block a user