Skip to content

Commit

Permalink
fix test_car_model.py segment format (#33915)
Browse files Browse the repository at this point in the history
fix test_car_model.py
  • Loading branch information
sshane authored Nov 1, 2024
1 parent 2af9f68 commit 4c0e292
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions tools/car_porting/test_car_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from opendbc.car.tests.routes import CarTestRoute
from openpilot.selfdrive.car.tests.test_models import TestCarModel
from openpilot.tools.lib.route import SegmentName
from openpilot.tools.lib.route import SegmentRange


def create_test_models_suite(routes: list[CarTestRoute], ci=False) -> unittest.TestSuite:
Expand All @@ -29,10 +29,9 @@ def create_test_models_suite(routes: list[CarTestRoute], ci=False) -> unittest.T
parser.print_help()
sys.exit()

route_or_segment_name = SegmentName(args.route_or_segment_name.strip(), allow_route_name=True)
segment_num = route_or_segment_name.segment_num if route_or_segment_name.segment_num != -1 else None
sr = SegmentRange(args.route_or_segment_name)

test_route = CarTestRoute(route_or_segment_name.route_name.canonical_name, args.car, segment=segment_num)
test_suite = create_test_models_suite([test_route], ci=args.ci)
test_routes = [CarTestRoute(sr.route_name, args.car, segment=seg_idx) for seg_idx in sr.seg_idxs]
test_suite = create_test_models_suite(test_routes, ci=args.ci)

unittest.TextTestRunner().run(test_suite)

0 comments on commit 4c0e292

Please sign in to comment.