Pytest: run tests in random order (#30134)

* enable random order

* logprint info

* revert that

* better logging

* go to dfu

* try to flash every panda if not up to date

* revert panda debugging
old-commit-hash: a5d99e0ebb
testing-closet
Justin Newberry 1 year ago committed by GitHub
parent 7cac430ecc
commit 586fe682e4
  1. 2
      pyproject.toml
  2. 4
      selfdrive/athena/tests/test_athenad.py
  3. 4
      selfdrive/controls/tests/test_state_machine.py

@ -1,6 +1,6 @@
[tool.pytest.ini_options] [tool.pytest.ini_options]
minversion = "6.0" minversion = "6.0"
addopts = "--ignore=openpilot/ --ignore=cereal/ --ignore=opendbc/ --ignore=panda/ --ignore=rednose_repo/ --ignore=tinygrad_repo/ -Werror --strict-config --strict-markers --durations=10 -n auto --dist=loadgroup" addopts = "--ignore=openpilot/ --ignore=cereal/ --ignore=opendbc/ --ignore=panda/ --ignore=rednose_repo/ --ignore=tinygrad_repo/ -Werror --strict-config --strict-markers --durations=10 -n auto --dist=loadgroup --random-order"
cpp_files = "test_*" cpp_files = "test_*"
python_files = "test_*.py" python_files = "test_*.py"
#timeout = "30" # you get this long by default #timeout = "30" # you get this long by default

@ -34,6 +34,8 @@ class TestAthenadMethods(unittest.TestCase):
athenad.LOCAL_PORT_WHITELIST = {cls.SOCKET_PORT} athenad.LOCAL_PORT_WHITELIST = {cls.SOCKET_PORT}
def setUp(self): def setUp(self):
dispatcher["listUploadQueue"]() # ensure queue is empty at start
MockParams.restore_defaults() MockParams.restore_defaults()
athenad.upload_queue = queue.Queue() athenad.upload_queue = queue.Queue()
athenad.cur_upload_items.clear() athenad.cur_upload_items.clear()
@ -46,8 +48,6 @@ class TestAthenadMethods(unittest.TestCase):
else: else:
os.unlink(p) os.unlink(p)
dispatcher["listUploadQueue"]() # ensure queue is empty at start
# *** test helpers *** # *** test helpers ***
@staticmethod @staticmethod

@ -1,5 +1,7 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import copy
import unittest import unittest
from unittest import mock
from cereal import car, log from cereal import car, log
from openpilot.common.realtime import DT_CTRL from openpilot.common.realtime import DT_CTRL
@ -17,6 +19,7 @@ ALL_STATES = tuple(State.schema.enumerants.values())
# The event types checked in DISABLED section of state machine # The event types checked in DISABLED section of state machine
ENABLE_EVENT_TYPES = (ET.ENABLE, ET.PRE_ENABLE, ET.OVERRIDE_LATERAL, ET.OVERRIDE_LONGITUDINAL) ENABLE_EVENT_TYPES = (ET.ENABLE, ET.PRE_ENABLE, ET.OVERRIDE_LATERAL, ET.OVERRIDE_LONGITUDINAL)
EVENTS = copy.copy(EVENTS)
def make_event(event_types): def make_event(event_types):
event = {} event = {}
@ -27,6 +30,7 @@ def make_event(event_types):
return 0 return 0
@mock.patch("openpilot.selfdrive.controls.lib.events.EVENTS", EVENTS)
class TestStateMachine(unittest.TestCase): class TestStateMachine(unittest.TestCase):
def setUp(self): def setUp(self):

Loading…
Cancel
Save