Car tests: fix serialize error on fail (#30185)

* Update test_toyota.py

* fix others

* fix
old-commit-hash: 9350b7e179
laptop
Shane Smiskol 2 years ago committed by GitHub
parent a62749f527
commit ef8028f134
  1. 8
      selfdrive/car/hyundai/tests/test_hyundai.py
  2. 6
      selfdrive/car/tests/test_fw_fingerprint.py
  3. 6
      selfdrive/car/toyota/tests/test_toyota.py

@ -62,7 +62,7 @@ class TestHyundaiFingerprint(unittest.TestCase):
# Asserts no ECUs known to be shared across platforms exist in the database. # Asserts no ECUs known to be shared across platforms exist in the database.
# Tucson having Santa Cruz camera and EPS for example # Tucson having Santa Cruz camera and EPS for example
for car_model, ecus in FW_VERSIONS.items(): for car_model, ecus in FW_VERSIONS.items():
with self.subTest(car_model=car_model): with self.subTest(car_model=car_model.value):
if car_model == CAR.SANTA_CRUZ_1ST_GEN: if car_model == CAR.SANTA_CRUZ_1ST_GEN:
raise unittest.SkipTest("Skip checking Santa Cruz for its parts") raise unittest.SkipTest("Skip checking Santa Cruz for its parts")
@ -79,7 +79,7 @@ class TestHyundaiFingerprint(unittest.TestCase):
""" """
expected_fw_prefix = HYUNDAI_VERSION_REQUEST_LONG[1:] expected_fw_prefix = HYUNDAI_VERSION_REQUEST_LONG[1:]
for car_model, ecus in FW_VERSIONS.items(): for car_model, ecus in FW_VERSIONS.items():
with self.subTest(car_model=car_model): with self.subTest(car_model=car_model.value):
for ecu, fws in ecus.items(): for ecu, fws in ecus.items():
# TODO: enable for Ecu.fwdRadar, Ecu.abs, Ecu.eps, Ecu.transmission # TODO: enable for Ecu.fwdRadar, Ecu.abs, Ecu.eps, Ecu.transmission
if ecu[0] in (Ecu.fwdCamera,): if ecu[0] in (Ecu.fwdCamera,):
@ -103,7 +103,7 @@ class TestHyundaiFingerprint(unittest.TestCase):
# Asserts ECU keys essential for fuzzy fingerprinting are available on all platforms # Asserts ECU keys essential for fuzzy fingerprinting are available on all platforms
for car_model, ecus in FW_VERSIONS.items(): for car_model, ecus in FW_VERSIONS.items():
with self.subTest(car_model=car_model): with self.subTest(car_model=car_model.value):
for platform_code_ecu in PLATFORM_CODE_ECUS: for platform_code_ecu in PLATFORM_CODE_ECUS:
if platform_code_ecu in (Ecu.fwdRadar, Ecu.eps) and car_model == CAR.HYUNDAI_GENESIS: if platform_code_ecu in (Ecu.fwdRadar, Ecu.eps) and car_model == CAR.HYUNDAI_GENESIS:
continue continue
@ -118,7 +118,7 @@ class TestHyundaiFingerprint(unittest.TestCase):
# - expected parsing of ECU FW dates # - expected parsing of ECU FW dates
for car_model, ecus in FW_VERSIONS.items(): for car_model, ecus in FW_VERSIONS.items():
with self.subTest(car_model=car_model): with self.subTest(car_model=car_model.value):
for ecu, fws in ecus.items(): for ecu, fws in ecus.items():
if ecu[0] not in PLATFORM_CODE_ECUS: if ecu[0] not in PLATFORM_CODE_ECUS:
continue continue

@ -97,7 +97,7 @@ class TestFwFingerprint(unittest.TestCase):
def test_fw_version_lists(self): def test_fw_version_lists(self):
for car_model, ecus in FW_VERSIONS.items(): for car_model, ecus in FW_VERSIONS.items():
with self.subTest(car_model=car_model): with self.subTest(car_model=car_model.value):
for ecu, ecu_fw in ecus.items(): for ecu, ecu_fw in ecus.items():
with self.subTest(ecu): with self.subTest(ecu):
duplicates = {fw for fw in ecu_fw if ecu_fw.count(fw) > 1} duplicates = {fw for fw in ecu_fw if ecu_fw.count(fw) > 1}
@ -119,13 +119,13 @@ class TestFwFingerprint(unittest.TestCase):
for brand, config in FW_QUERY_CONFIGS.items(): for brand, config in FW_QUERY_CONFIGS.items():
for car_model, ecus in VERSIONS[brand].items(): for car_model, ecus in VERSIONS[brand].items():
bad_ecus = set(ecus).intersection(config.extra_ecus) bad_ecus = set(ecus).intersection(config.extra_ecus)
with self.subTest(car_model=car_model): with self.subTest(car_model=car_model.value):
self.assertFalse(len(bad_ecus), f'{car_model}: Fingerprints contain ECUs added for data collection: {bad_ecus}') self.assertFalse(len(bad_ecus), f'{car_model}: Fingerprints contain ECUs added for data collection: {bad_ecus}')
def test_blacklisted_ecus(self): def test_blacklisted_ecus(self):
blacklisted_addrs = (0x7c4, 0x7d0) # includes A/C ecu and an unknown ecu blacklisted_addrs = (0x7c4, 0x7d0) # includes A/C ecu and an unknown ecu
for car_model, ecus in FW_VERSIONS.items(): for car_model, ecus in FW_VERSIONS.items():
with self.subTest(car_model=car_model): with self.subTest(car_model=car_model.value):
CP = interfaces[car_model][0].get_non_essential_params(car_model) CP = interfaces[car_model][0].get_non_essential_params(car_model)
if CP.carName == 'subaru': if CP.carName == 'subaru':
for ecu in ecus.keys(): for ecu in ecus.keys():

@ -26,7 +26,7 @@ class TestToyotaInterfaces(unittest.TestCase):
# Asserts standard ECUs exist for each platform # Asserts standard ECUs exist for each platform
common_ecus = {Ecu.fwdRadar, Ecu.fwdCamera} common_ecus = {Ecu.fwdRadar, Ecu.fwdCamera}
for car_model, ecus in FW_VERSIONS.items(): for car_model, ecus in FW_VERSIONS.items():
with self.subTest(car_model=car_model): with self.subTest(car_model=car_model.value):
present_ecus = {ecu[0] for ecu in ecus} present_ecus = {ecu[0] for ecu in ecus}
missing_ecus = common_ecus - present_ecus missing_ecus = common_ecus - present_ecus
self.assertEqual(len(missing_ecus), 0) self.assertEqual(len(missing_ecus), 0)
@ -55,7 +55,7 @@ class TestToyotaFingerprint(unittest.TestCase):
def test_platform_code_ecus_available(self): def test_platform_code_ecus_available(self):
# Asserts ECU keys essential for fuzzy fingerprinting are available on all platforms # Asserts ECU keys essential for fuzzy fingerprinting are available on all platforms
for car_model, ecus in FW_VERSIONS.items(): for car_model, ecus in FW_VERSIONS.items():
with self.subTest(car_model=car_model): with self.subTest(car_model=car_model.value):
for platform_code_ecu in PLATFORM_CODE_ECUS: for platform_code_ecu in PLATFORM_CODE_ECUS:
if platform_code_ecu == Ecu.eps and car_model in (CAR.PRIUS_V, CAR.LEXUS_CTH,): if platform_code_ecu == Ecu.eps and car_model in (CAR.PRIUS_V, CAR.LEXUS_CTH,):
continue continue
@ -70,7 +70,7 @@ class TestToyotaFingerprint(unittest.TestCase):
# - expected parsing of ECU sub-versions # - expected parsing of ECU sub-versions
for car_model, ecus in FW_VERSIONS.items(): for car_model, ecus in FW_VERSIONS.items():
with self.subTest(car_model=car_model): with self.subTest(car_model=car_model.value):
for ecu, fws in ecus.items(): for ecu, fws in ecus.items():
if ecu[0] not in PLATFORM_CODE_ECUS: if ecu[0] not in PLATFORM_CODE_ECUS:
continue continue

Loading…
Cancel
Save