diff --git a/conftest.py b/conftest.py index fc4931fb54d2f9..7ee0c789435537 100644 --- a/conftest.py +++ b/conftest.py @@ -8,6 +8,19 @@ from openpilot.system.manager import manager from openpilot.system.hardware import TICI, HARDWARE +# TODO: pytest-cpp doesn't support FAIL, and we need to create test translations in sessionstart +# pending https://github.com/pytest-dev/pytest-cpp/pull/147 +collect_ignore = [ + "selfdrive/ui/tests/test_translations", + "selfdrive/test/process_replay/test_processes.py", + "selfdrive/test/process_replay/test_regen.py", + "selfdrive/test/test_time_to_onroad.py", +] +collect_ignore_glob = [ + "selfdrive/debug/*.py", + "selfdrive/modeld/*.py", +] + def pytest_sessionstart(session): # TODO: fix tests and enable test order randomization diff --git a/pyproject.toml b/pyproject.toml index 8ed4ff855b5631..00b9ecf3e5a0ec 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -148,14 +148,7 @@ markers = [ ] testpaths = [ "common", - "selfdrive/pandad", - "selfdrive/car", - "selfdrive/opcar", - "selfdrive/controls", - "selfdrive/locationd", - "selfdrive/monitoring", - "selfdrive/test/longitudinal_maneuvers", - "selfdrive/test/process_replay/test_fuzzy.py", + "selfdrive", "system/updated", "system/athena", "system/camerad", diff --git a/selfdrive/selfdrived/tests/test_alertmanager.py b/selfdrive/selfdrived/tests/test_alertmanager.py index 20bf4e89031a2b..b75a4d1cbe3b3b 100644 --- a/selfdrive/selfdrived/tests/test_alertmanager.py +++ b/selfdrive/selfdrived/tests/test_alertmanager.py @@ -1,6 +1,6 @@ import random -from openpilot.selfdrive.selfdrived.events import Alert, EVENTS +from openpilot.selfdrive.selfdrived.events import Alert, EmptyAlert, EVENTS from openpilot.selfdrive.selfdrived.alertmanager import AlertManager @@ -34,6 +34,6 @@ def test_duration(self): AM.add_many(frame, [alert, ]) AM.process_alerts(frame, {}) - shown = AM.current_alert is not None + shown = AM.current_alert != EmptyAlert should_show = frame <= show_duration assert shown == should_show, f"{frame=} {add_duration=} {duration=}" diff --git a/selfdrive/selfdrived/tests/test_alerts.py b/selfdrive/selfdrived/tests/test_alerts.py index b916741ad07632..f6a0e365fce070 100644 --- a/selfdrive/selfdrived/tests/test_alerts.py +++ b/selfdrive/selfdrived/tests/test_alerts.py @@ -33,7 +33,7 @@ def setup_class(cls): # Create fake objects for callback cls.CS = car.CarState.new_message() cls.CP = car.CarParams.new_message() - cfg = [c for c in CONFIGS if c.proc_name == 'controlsd'][0] + cfg = [c for c in CONFIGS if c.proc_name == 'selfdrived'][0] cls.sm = SubMaster(cfg.pubs) def test_events_defined(self): diff --git a/selfdrive/test/cpp_harness.py b/selfdrive/test/cpp_harness.py index f9d3e681a54ffa..f9f425102b8515 100755 --- a/selfdrive/test/cpp_harness.py +++ b/selfdrive/test/cpp_harness.py @@ -4,8 +4,7 @@ from openpilot.common.prefix import OpenpilotPrefix - with OpenpilotPrefix(): ret = subprocess.call(sys.argv[1:]) -exit(ret) +sys.exit(ret) diff --git a/selfdrive/test/process_replay/process_replay.py b/selfdrive/test/process_replay/process_replay.py index 0b71a2a1b9e990..a5008931c8aede 100755 --- a/selfdrive/test/process_replay/process_replay.py +++ b/selfdrive/test/process_replay/process_replay.py @@ -466,7 +466,7 @@ def selfdrived_config_callback(params, cfg, lr): "longitudinalPlan", "livePose", "liveParameters", "radarState", "modelV2", "driverCameraState", "roadCameraState", "wideRoadCameraState", "managerState", "liveTorqueParameters", "accelerometer", "gyroscope", "carOutput", - "gpsLocationExternal", "gpsLocation", "controlsState", "carControl", "driverAssistance", + "gpsLocationExternal", "gpsLocation", "controlsState", "carControl", "driverAssistance", "alertDebug", ], subs=["selfdriveState", "onroadEvents"], ignore=["logMonoTime"], diff --git a/selfdrive/ui/tests/test_runner.cc b/selfdrive/ui/tests/test_runner.cc index ac63139d178a89..c8cc0d3e055123 100644 --- a/selfdrive/ui/tests/test_runner.cc +++ b/selfdrive/ui/tests/test_runner.cc @@ -11,6 +11,7 @@ int main(int argc, char **argv) { QApplication app(argc, argv); QString language_file = "main_test_en"; + // FIXME: pytest-cpp considers this print as a test case qDebug() << "Loading language:" << language_file; QTranslator translator;