Files
github-actions[bot] 3dcc048299 sunnypilot v2026.002.000 release
date: 2026-06-19T21:43:27
master commit: 5d90689776fdc7a3be31fc1335003aee20a2ba62
2026-06-19 21:43:47 +08:00

39 lines
1.3 KiB
Python

import pytest
from openpilot.common.params import Params
from openpilot.system.updated.updated import Updater
@pytest.mark.parametrize(("device_type", "branch", "expected"), [
("tizi", "release3", "release-tizi"),
("tizi", "release3-staging", "release-tizi-staging"),
("mici", "release3", "release-mici"),
("mici", "release3-staging", "release-mici-staging"),
])
def test_target_branch_migration_from_current_branch(mocker, device_type, branch, expected):
params = Params()
params.remove("UpdaterTargetBranch")
mocker.patch("openpilot.system.updated.updated.HARDWARE.get_device_type", return_value=device_type)
mocker.patch.object(Updater, "get_branch", return_value=branch)
assert Updater().target_branch == expected
@pytest.mark.parametrize(("device_type", "branch", "expected"), [
("tizi", "release3", "release-tizi"),
("tizi", "release3-staging", "release-tizi-staging"),
("mici", "release3", "release-mici"),
("mici", "release3-staging", "release-mici-staging"),
])
def test_target_branch_migration_from_param(mocker, device_type, branch, expected):
params = Params()
params.put("UpdaterTargetBranch", branch, block=True)
mocker.patch("openpilot.system.updated.updated.HARDWARE.get_device_type", return_value=device_type)
try:
assert Updater().target_branch == expected
finally:
params.remove("UpdaterTargetBranch")