CI: use "slow" marker for pytest (#30063)

* skip to mark

* fix quotes
pull/30066/head
Justin Newberry 2 years ago committed by GitHub
parent 7d4fead1b8
commit 0251742079
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      .github/workflows/selfdrive_tests.yaml
  2. 2
      pyproject.toml
  3. 5
      selfdrive/car/tests/test_models.py
  4. 5
      selfdrive/locationd/test/test_laikad.py
  5. 1
      selfdrive/test/helpers.py

@ -268,8 +268,7 @@ jobs:
- name: Run unit tests - name: Run unit tests
timeout-minutes: 15 timeout-minutes: 15
run: | run: |
${{ env.RUN }} "export SKIP_LONG_TESTS=1 && \ ${{ env.RUN }} "$PYTEST -n auto --dist=loadscope --timeout 30 -o cpp_files=test_* -m 'not slow' && \
$PYTEST -n auto --dist=loadscope --timeout 30 -o cpp_files=test_* && \
./selfdrive/ui/tests/create_test_translations.sh && \ ./selfdrive/ui/tests/create_test_translations.sh && \
QT_QPA_PLATFORM=offscreen ./selfdrive/ui/tests/test_translations && \ QT_QPA_PLATFORM=offscreen ./selfdrive/ui/tests/test_translations && \
./selfdrive/ui/tests/test_translations.py && \ ./selfdrive/ui/tests/test_translations.py && \

@ -5,7 +5,7 @@ addopts = "--ignore=openpilot/ --ignore=cereal/ --ignore=opendbc/ --ignore=panda
python_files = "test_*.py" python_files = "test_*.py"
#timeout = "30" # you get this long by default #timeout = "30" # you get this long by default
markers = [ markers = [
"parallel: mark tests as parallelizable (tests with no global state, so can be run in parallel)" "slow: tests that take awhile to run and can be skipped with -m 'not slow'"
] ]
testpaths = [ testpaths = [
"common", "common",

@ -2,6 +2,7 @@
import capnp import capnp
import os import os
import importlib import importlib
import pytest
import unittest import unittest
from collections import defaultdict, Counter from collections import defaultdict, Counter
from typing import List, Optional, Tuple from typing import List, Optional, Tuple
@ -23,7 +24,6 @@ from openpilot.tools.lib.logreader import LogReader
from openpilot.tools.lib.route import Route, SegmentName, RouteName from openpilot.tools.lib.route import Route, SegmentName, RouteName
from panda.tests.libpanda import libpanda_py from panda.tests.libpanda import libpanda_py
from openpilot.selfdrive.test.helpers import SKIP_ENV_VAR
EventName = car.CarEvent.EventName EventName = car.CarEvent.EventName
PandaType = log.PandaState.PandaType PandaType = log.PandaState.PandaType
@ -67,7 +67,7 @@ def get_test_cases() -> List[Tuple[str, Optional[CarTestRoute]]]:
return test_cases return test_cases
@pytest.mark.slow
class TestCarModelBase(unittest.TestCase): class TestCarModelBase(unittest.TestCase):
car_model: Optional[str] = None car_model: Optional[str] = None
test_route: Optional[CarTestRoute] = None test_route: Optional[CarTestRoute] = None
@ -76,7 +76,6 @@ class TestCarModelBase(unittest.TestCase):
can_msgs: List[capnp.lib.capnp._DynamicStructReader] can_msgs: List[capnp.lib.capnp._DynamicStructReader]
elm_frame: Optional[int] elm_frame: Optional[int]
@unittest.skipIf(SKIP_ENV_VAR in os.environ, f"Long running test skipped. Unset {SKIP_ENV_VAR} to run")
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
if cls.__name__ == 'TestCarModel' or cls.__name__.endswith('Base'): if cls.__name__ == 'TestCarModel' or cls.__name__.endswith('Base'):

@ -1,5 +1,5 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import os import pytest
import time import time
import unittest import unittest
from cereal import log from cereal import log
@ -19,7 +19,6 @@ from openpilot.selfdrive.test.openpilotci import get_url
from openpilot.tools.lib.logreader import LogReader from openpilot.tools.lib.logreader import LogReader
from openpilot.selfdrive.test.process_replay.process_replay import get_process_config, replay_process from openpilot.selfdrive.test.process_replay.process_replay import get_process_config, replay_process
from openpilot.selfdrive.test.helpers import SKIP_ENV_VAR
GPS_TIME_PREDICTION_ORBITS_RUSSIAN_SRC = GPSTime.from_datetime(datetime(2022, month=1, day=29, hour=12)) GPS_TIME_PREDICTION_ORBITS_RUSSIAN_SRC = GPSTime.from_datetime(datetime(2022, month=1, day=29, hour=12))
UBLOX_TEST_ROUTE = "4cf7a6ad03080c90|2021-09-29--13-46-36" UBLOX_TEST_ROUTE = "4cf7a6ad03080c90|2021-09-29--13-46-36"
@ -94,7 +93,7 @@ def get_measurement_mock(gpstime, sat_ephemeris):
return meas return meas
@unittest.skipIf(SKIP_ENV_VAR in os.environ, f"Laika test skipped since it's long and not currently used. Unset {SKIP_ENV_VAR} to run") @pytest.mark.slow
class TestLaikad(unittest.TestCase): class TestLaikad(unittest.TestCase):
@classmethod @classmethod

@ -9,7 +9,6 @@ from openpilot.selfdrive.manager.process_config import managed_processes
from openpilot.system.hardware import PC from openpilot.system.hardware import PC
from openpilot.system.version import training_version, terms_version from openpilot.system.version import training_version, terms_version
SKIP_ENV_VAR = "SKIP_LONG_TESTS"
def set_params_enabled(): def set_params_enabled():
os.environ['PASSIVE'] = "0" os.environ['PASSIVE'] = "0"

Loading…
Cancel
Save