From 8adfc992e3684c21369412d7890e741e16196349 Mon Sep 17 00:00:00 2001 From: Maxime Desroches Date: Fri, 28 Jun 2024 16:58:19 -0700 Subject: [PATCH] fix pytest tests (#32867) * fix tests * no dot old-commit-hash: 6f10b8a20989031d4cc04e8b8ce38eaea4a4824e --- docs/WORKFLOW.md | 2 +- pyproject.toml | 2 +- system/updated/tests/test_base.py | 2 +- tools/lib/tests/test_logreader.py | 6 ++++++ 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/docs/WORKFLOW.md b/docs/WORKFLOW.md index 85ae8d86f4..1babe3c94a 100644 --- a/docs/WORKFLOW.md +++ b/docs/WORKFLOW.md @@ -22,7 +22,7 @@ scons -j8 selfdrive/ui/ cd selfdrive/ui/ && scons -u -j8 # test everything -pytest . +pytest # test just logging services cd system/loggerd && pytest . diff --git a/pyproject.toml b/pyproject.toml index 6912d80f0f..fc2356645b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -137,7 +137,7 @@ packages = [ "." ] [tool.pytest.ini_options] minversion = "6.0" -addopts = "--ignore=openpilot/ --ignore=cereal/ --ignore=opendbc/ --ignore=panda/ --ignore=rednose_repo/ --ignore=tinygrad_repo/ --ignore=teleoprtc_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/ --ignore=teleoprtc_repo/ --ignore=msgq/ -Werror --strict-config --strict-markers --durations=10 -n auto --dist=loadgroup" cpp_files = "test_*" cpp_harness = "selfdrive/test/cpp_harness.py" python_files = "test_*.py" diff --git a/system/updated/tests/test_base.py b/system/updated/tests/test_base.py index 928d07cbe3..52287c58f9 100644 --- a/system/updated/tests/test_base.py +++ b/system/updated/tests/test_base.py @@ -133,7 +133,7 @@ class TestBaseUpdate: class ParamsBaseUpdateTest(TestBaseUpdate): def _test_finalized_update(self, branch, version, agnos_version, release_notes): assert self.params.get("UpdaterNewDescription", encoding="utf-8").startswith(f"{version} / {branch}") - assert self.params.get("UpdaterNewReleaseNotes", encoding="utf-8") == f"

{release_notes}

\n" + assert self.params.get("UpdaterNewReleaseNotes", encoding="utf-8") == f"{release_notes}\n" super()._test_finalized_update(branch, version, agnos_version, release_notes) def send_check_for_updates_signal(self, updated: ManagerProcess): diff --git a/tools/lib/tests/test_logreader.py b/tools/lib/tests/test_logreader.py index 6bc7ba8773..f827c25902 100644 --- a/tools/lib/tests/test_logreader.py +++ b/tools/lib/tests/test_logreader.py @@ -27,8 +27,14 @@ def noop(segment: LogIterable): @contextlib.contextmanager def setup_source_scenario(mocker, is_internal=False): internal_source_mock = mocker.patch("openpilot.tools.lib.logreader.internal_source") + internal_source_mock.__name__ = internal_source_mock._mock_name + openpilotci_source_mock = mocker.patch("openpilot.tools.lib.logreader.openpilotci_source") + openpilotci_source_mock.__name__ = openpilotci_source_mock._mock_name + comma_api_source_mock = mocker.patch("openpilot.tools.lib.logreader.comma_api_source") + comma_api_source_mock.__name__ = comma_api_source_mock._mock_name + if is_internal: internal_source_mock.return_value = [QLOG_FILE] else: