Skip to content

Commit

Permalink
test_navd: parameterize random test (commaai#31376)
Browse files Browse the repository at this point in the history
* parameterized

* import

* dumb
old-commit-hash: 1c20129
  • Loading branch information
jnewb1 authored Feb 8, 2024
1 parent eee5af9 commit a1d331c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion selfdrive/manager/test/test_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def test_blacklisted_procs(self):
# TODO: ensure there are blacklisted procs until we have a dedicated test
self.assertTrue(len(BLACKLIST_PROCS), "No blacklisted procs to test not_run")

@parameterized.expand(range(10))
@parameterized.expand([(i,) for i in range(10)])
def test_startup_time(self, index):
start = time.monotonic()
os.environ['PREPAREONLY'] = '1'
Expand Down
12 changes: 7 additions & 5 deletions selfdrive/navd/tests/test_navd.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import unittest
import numpy as np

from parameterized import parameterized

import cereal.messaging as messaging
from openpilot.common.params import Params
from openpilot.selfdrive.manager.process_config import managed_processes
Expand Down Expand Up @@ -50,11 +52,11 @@ def test_simple(self):
}
self._check_route(start, end)

def test_random(self):
for _ in range(10):
start = {"latitude": random.uniform(-90, 90), "longitude": random.uniform(-180, 180)}
end = {"latitude": random.uniform(-90, 90), "longitude": random.uniform(-180, 180)}
self._check_route(start, end, check_coords=False)
@parameterized.expand([(i,) for i in range(10)])
def test_random(self, index):
start = {"latitude": random.uniform(-90, 90), "longitude": random.uniform(-180, 180)}
end = {"latitude": random.uniform(-90, 90), "longitude": random.uniform(-180, 180)}
self._check_route(start, end, check_coords=False)


if __name__ == "__main__":
Expand Down

0 comments on commit a1d331c

Please sign in to comment.