mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-11-30 00:33:41 +08:00
Run Locked Ty in an Isolated Environment
This commit is contained in:
@@ -66,7 +66,7 @@ jobs:
|
||||
timeout-minutes: 1
|
||||
run: |
|
||||
ruff check openpilot/starpilot/flm openpilot/selfdrive/controls/controlsd.py openpilot/selfdrive/controls/lib/latcontrol_pid.py openpilot/selfdrive/controls/lib/latcontrol_torque.py openpilot/system/manager/process_config.py
|
||||
ty check openpilot/starpilot/flm openpilot/selfdrive/controls/controlsd.py openpilot/selfdrive/controls/lib/latcontrol_pid.py openpilot/selfdrive/controls/lib/latcontrol_torque.py openpilot/system/manager/process_config.py
|
||||
uv run --isolated --frozen --only-group typecheck ty check --python "$(command -v python3)" openpilot/starpilot/flm openpilot/selfdrive/controls/controlsd.py openpilot/selfdrive/controls/lib/latcontrol_pid.py openpilot/selfdrive/controls/lib/latcontrol_torque.py openpilot/system/manager/process_config.py
|
||||
- name: Build native dependencies
|
||||
timeout-minutes: 10
|
||||
run: scons
|
||||
|
||||
@@ -57,8 +57,8 @@ class SyntheticAdapter:
|
||||
def required_cohorts(self):
|
||||
return ('left', 'right')
|
||||
|
||||
def physical_observable(self, row):
|
||||
return row.speed_mps > 15
|
||||
def physical_observable(self, value):
|
||||
return value.speed_mps > 15
|
||||
|
||||
def cohort(self, control, physical):
|
||||
return 'left' if control.requested > 0 else 'right'
|
||||
@@ -69,7 +69,7 @@ class SyntheticAdapter:
|
||||
def response_target(self, control, physical, applied, context):
|
||||
return self.model.inverse(physical['lateral_accel'])
|
||||
|
||||
def current_admission(self, profile, control, output, context):
|
||||
def current_admission(self, profile, control, output, physical_context):
|
||||
return CurrentAdmission(
|
||||
control.identity, 'synthetic-baseline', 'synthetic-physical', min(control.control_ns, output.apply_ns), True, control.enabled, control.manual, True
|
||||
)
|
||||
|
||||
@@ -60,12 +60,12 @@ def gpu():
|
||||
gl.CGLDestroyContext(context)
|
||||
elif os.getenv("STARPILOT_TEST_SOFTWARE_EGL") == "1":
|
||||
from openpilot.starpilot.system.starport.tests.software_egl import SoftwareEGLContext
|
||||
context = SoftwareEGLContext(rl)
|
||||
software_context = SoftwareEGLContext(rl)
|
||||
# The wheel bundles Mesa; the host's GLES library may use a separate
|
||||
# dispatch table and cannot read framebuffers from this EGL context.
|
||||
load_library = C.CDLL
|
||||
patch.setattr(headless_egl.C, "CDLL", lambda name: context.gl if name == "libGLESv2.so" else load_library(name))
|
||||
close = context.close
|
||||
patch.setattr(headless_egl.C, "CDLL", lambda name: software_context.gl if name == "libGLESv2.so" else load_library(name))
|
||||
close = software_context.close
|
||||
else:
|
||||
context = headless_egl.HeadlessContext(64, 64)
|
||||
close = context.close
|
||||
|
||||
@@ -128,13 +128,14 @@ class TestOptInLayouts(unittest.TestCase):
|
||||
self.assertEqual(home.alert_notif_rect.x, 340)
|
||||
|
||||
def test_compact_constructor_replaces_scroller_pages_and_keeps_camera_owner(self):
|
||||
from openpilot.selfdrive.ui.mici.layouts.main import AugmentedRoadView, MiciHomeLayout
|
||||
session = self._session()
|
||||
camera = Mock()
|
||||
camera = Mock(spec=AugmentedRoadView)
|
||||
scroller = NS(items=[Mock(), Mock(), Mock(), Mock()], set_scrolling_enabled=Mock())
|
||||
|
||||
def parent_init(layout):
|
||||
layout._car_onroad_layout = camera
|
||||
layout._home_layout = Mock()
|
||||
layout._home_layout = Mock(spec=MiciHomeLayout, _alerts_pill=Mock())
|
||||
layout._scroller = scroller
|
||||
|
||||
with patch.object(runtime_app, "validate_runtime_fonts"), patch.object(runtime_app, "validate_runtime_assets"), \
|
||||
@@ -166,7 +167,11 @@ class TestOptInLayouts(unittest.TestCase):
|
||||
|
||||
stack.enter_context(patch.object(main.Scroller, "__init__", scroller_init))
|
||||
for owner in ("MiciHomeLayout", "MiciOffroadAlerts", "AugmentedRoadView", "BodyLayout", "OnboardingWindow"):
|
||||
stack.enter_context(patch.object(main, owner))
|
||||
spec = getattr(main, owner)
|
||||
factory = stack.enter_context(patch.object(main, owner))
|
||||
factory.return_value = Mock(spec=spec)
|
||||
if owner == "MiciHomeLayout":
|
||||
factory.return_value._alerts_pill = Mock()
|
||||
settings_factory = stack.enter_context(patch.object(main, "SettingsLayout"))
|
||||
stack.enter_context(patch.object(main.messaging, "PubMaster"))
|
||||
stack.enter_context(patch.object(main, "gui_app"))
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"protected_inventory_sha256": "a92f934595842bc577779700469fab73c4074948b3a6039f90aa4ff0141c55e4", "schema_version": 1}
|
||||
{"protected_inventory_sha256": "fe79986094e627a52b9a9f5aa7b5c6e78a8181878edf09f58c1dfa439a139759", "schema_version": 1}
|
||||
|
||||
+1
-1
@@ -69,7 +69,6 @@ safety = [
|
||||
]
|
||||
testing = [
|
||||
"coverage", # line coverage
|
||||
"ty", # type checking
|
||||
"ruff", # linting
|
||||
"codespell", # spellcheck
|
||||
]
|
||||
@@ -104,6 +103,7 @@ Homepage = "https://github.com/commaai/openpilot"
|
||||
standalone = [
|
||||
"openpilot[vendored]",
|
||||
]
|
||||
typecheck = ["ty==0.0.112"]
|
||||
|
||||
[build-system]
|
||||
requires = ["hatchling"]
|
||||
|
||||
@@ -53,7 +53,7 @@ function run_tests() {
|
||||
run "check_nomerge_comments" "$DIR/check_nomerge_comments.sh" "${ALL_FILES[@]}"
|
||||
|
||||
if [[ -z "$FAST" ]]; then
|
||||
run "ty" ty check openpilot
|
||||
run "ty" uv run --isolated --frozen --only-group typecheck ty check --python "$(command -v python3)" openpilot
|
||||
run "codespell" codespell "${ALL_FILES[@]}"
|
||||
fi
|
||||
|
||||
|
||||
@@ -751,7 +751,6 @@ testing = [
|
||||
{ name = "codespell" },
|
||||
{ name = "coverage" },
|
||||
{ name = "ruff" },
|
||||
{ name = "ty" },
|
||||
]
|
||||
tools = [
|
||||
{ name = "comma-deps-bootstrap-icons" },
|
||||
@@ -775,6 +774,9 @@ vendored = [
|
||||
standalone = [
|
||||
{ name = "openpilot", extra = ["vendored"] },
|
||||
]
|
||||
typecheck = [
|
||||
{ name = "ty" },
|
||||
]
|
||||
|
||||
[package.metadata]
|
||||
requires-dist = [
|
||||
@@ -822,7 +824,6 @@ requires-dist = [
|
||||
{ name = "tqdm" },
|
||||
{ name = "tree-sitter", marker = "extra == 'safety'", specifier = "==0.26.0" },
|
||||
{ name = "tree-sitter-c", marker = "extra == 'safety'", specifier = "==0.24.2" },
|
||||
{ name = "ty", marker = "extra == 'testing'" },
|
||||
{ name = "websocket-client" },
|
||||
{ name = "zstandard" },
|
||||
]
|
||||
@@ -830,6 +831,7 @@ provides-extras = ["dev", "safety", "testing", "tools", "vendored"]
|
||||
|
||||
[package.metadata.requires-dev]
|
||||
standalone = [{ name = "openpilot", extras = ["vendored"] }]
|
||||
typecheck = [{ name = "ty", specifier = "==0.0.112" }]
|
||||
|
||||
[[package]]
|
||||
name = "packaging"
|
||||
@@ -1230,7 +1232,7 @@ requires-dist = [
|
||||
{ name = "boto3", marker = "extra == 'testing'" },
|
||||
{ name = "bottle", marker = "extra == 'testing'" },
|
||||
{ name = "capstone", marker = "extra == 'testing-unit'" },
|
||||
{ name = "gguf", marker = "extra == 'testing-unit'", specifier = ">=0.18" },
|
||||
{ name = "gguf", marker = "extra == 'testing-unit'", specifier = ">=0.19" },
|
||||
{ name = "hypothesis", marker = "extra == 'testing-minimal'", specifier = ">=6.148.9" },
|
||||
{ name = "influxdb3-python", marker = "extra == 'testing'" },
|
||||
{ name = "librosa", marker = "extra == 'testing'" },
|
||||
|
||||
Reference in New Issue
Block a user