From 574021a0acd7f632b902efe858a22cb7b66b67e6 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Mon, 15 Aug 2022 21:44:15 -0700 Subject: [PATCH] Car docs: test for missing harnesses (#25444) * All cars must have a harness * except body * skip test * Q for IoniQ --- selfdrive/car/docs_definitions.py | 3 +-- selfdrive/car/hyundai/values.py | 2 +- selfdrive/car/tests/test_docs.py | 10 +++++++++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/selfdrive/car/docs_definitions.py b/selfdrive/car/docs_definitions.py index 0605ec1f2a..65dbe4c626 100644 --- a/selfdrive/car/docs_definitions.py +++ b/selfdrive/car/docs_definitions.py @@ -92,8 +92,6 @@ class CarInfo: else: self.min_steer_speed = CP.minSteerSpeed - assert self.harness is not None, f"{CP.carFingerprint}: Need to specify car harness" - # TODO: set all the min enable speeds in carParams correctly and remove this if self.min_enable_speed is None: self.min_enable_speed = CP.minEnableSpeed @@ -212,6 +210,7 @@ class Harness(Enum): hyundai_n = "Hyundai N" hyundai_o = "Hyundai O" hyundai_p = "Hyundai P" + hyundai_q = "Hyundai Q" custom = "Developer" obd_ii = "OBD-II" gm = "GM" diff --git a/selfdrive/car/hyundai/values.py b/selfdrive/car/hyundai/values.py index 8879931b20..625b2630f3 100644 --- a/selfdrive/car/hyundai/values.py +++ b/selfdrive/car/hyundai/values.py @@ -127,7 +127,7 @@ CAR_INFO: Dict[str, Optional[Union[HyundaiCarInfo, List[HyundaiCarInfo]]]] = { ], CAR.VELOSTER: HyundaiCarInfo("Hyundai Veloster 2019-20", "Smart Cruise Control (SCC)", min_enable_speed=5. * CV.MPH_TO_MS, harness=Harness.hyundai_e), CAR.SONATA_HYBRID: HyundaiCarInfo("Hyundai Sonata Hybrid 2020-22", "All", harness=Harness.hyundai_a), - CAR.IONIQ_5: HyundaiCarInfo("Hyundai Ioniq 5 2022", "Highway Driving Assist II", harness=Harness.none), + CAR.IONIQ_5: HyundaiCarInfo("Hyundai Ioniq 5 2022", "Highway Driving Assist II", harness=Harness.hyundai_q), # Kia CAR.KIA_FORTE: [ diff --git a/selfdrive/car/tests/test_docs.py b/selfdrive/car/tests/test_docs.py index e31ad0d5c1..84c6b6e520 100755 --- a/selfdrive/car/tests/test_docs.py +++ b/selfdrive/car/tests/test_docs.py @@ -4,7 +4,7 @@ import unittest from selfdrive.car.car_helpers import interfaces, get_interface_attr from selfdrive.car.docs import CARS_MD_OUT, CARS_MD_TEMPLATE, generate_cars_md, get_all_car_info -from selfdrive.car.docs_definitions import Column, Star +from selfdrive.car.docs_definitions import Column, Harness, Star from selfdrive.car.honda.values import CAR as HONDA @@ -56,6 +56,14 @@ class TestCarDocs(unittest.TestCase): with self.subTest(car=car): self.assertIsNone(re.search(r"\d{4}-\d{4}", car.name), f"Format years correctly: {car.name}") + def test_harnesses(self): + for car in self.all_cars: + with self.subTest(car=car): + if car.name == "comma body": + raise unittest.SkipTest + + self.assertNotIn(car.harness, [None, Harness.none], f"Need to specify car harness: {car.name}") + if __name__ == "__main__": unittest.main()