Files
StarPilot/openpilot/starpilot/tests/test_ford_ci_registration.py
T

59 lines
2.9 KiB
Python

"""Qualified Ford configurations remain collected by both CI lanes."""
import ast
from tools.ci import run_vehicle_tests as runner
FAMILY_TARGETS = (
'openpilot/starpilot/tests/test_ford_bluepilot_library_lifecycle.py',
'openpilot/starpilot/tests/test_ford_first_gas_grant.py',
'openpilot/starpilot/tests/test_ford_temporary_eps_intent.py',
'openpilot/starpilot/tests/test_ford_reverse_native_echo.py',
'openpilot/starpilot/tests/test_bluepilot_vendor_pin.py',
'opendbc_repo/opendbc/safety/tests/test_ford_bluepilot_hooks.py',
'opendbc_repo/opendbc/safety/tests/test_ford_canfd_display.py',
'openpilot/starpilot/tests/test_ford_configuration_parity.py',
'openpilot/starpilot/tests/test_ford_configuration_admission.py',
'openpilot/starpilot/tests/test_ford_release_long_preferences.py',
'openpilot/selfdrive/car/tests/test_registered_ford_discovery.py',
'openpilot/selfdrive/car/tests/test_automatic_ford_discovery.py',
'opendbc_repo/opendbc/safety/tests/test_ford_configuration_parity.py',
'opendbc_repo/opendbc/safety/tests/test_ford_alpha_aol.py',
'opendbc_repo/opendbc/safety/tests/test_ford_full_engagement.py',
)
def test_both_actual_ci_selectors_collect_all_qualified_ford_configuration_contracts():
for suite in ('aol-lifecycle', 'safety-release'):
selected = runner.targets_for(suite)
for path in FAMILY_TARGETS:
assert path in selected
assert (runner.ROOT / path).is_file()
# RELEASE CAN FD Alpha: the stock CAN FD long word runs its complete positive contract on the release library
release = runner.targets_for('safety-release')
prefix = 'opendbc_repo/opendbc/safety/tests/test_ford.py::'
assert prefix + 'TestFordCANFDLongitudinalSafety' in release
source = ast.parse((runner.ROOT / prefix.split('::', 1)[0]).read_text())
assert any(isinstance(node, ast.ClassDef) and node.name == 'TestFordCANFDLongitudinalSafety' for node in source.body)
def test_actual_host_collector_discovers_release_ui_guards(tmp_path):
from tools.ci.run_host_tests import pytest_files
name = 'openpilot/starpilot/ui/tests/test_ford_release_alpha.py'
target = tmp_path / name
target.parent.mkdir(parents=True)
target.write_bytes((runner.ROOT / name).read_bytes())
assert name in pytest_files(tmp_path)
def test_imported_native_cases_retain_complete_release_coverage():
native = {str(path.relative_to(runner.ROOT)) for path in
(runner.ROOT / 'opendbc_repo/opendbc/bluepilot_lateral/safety/tests').glob('test_*.py')}
assert native
assert native <= set(runner.targets_for('safety-release'))
assert native <= set(runner.targets_for('safety-debug'))
assert native.isdisjoint(runner.targets_for('aol-lifecycle'))
# Actual host/native AOL lifecycle contracts still run in both required lanes.
for path in FAMILY_TARGETS:
assert path in runner.targets_for('aol-lifecycle')
assert path in runner.targets_for('safety-release')