[tests] Cover the libretiny branch of the interactive wizard

The interactive wizard's platform / board-link / boards-list elif chain
includes an ``elif platform == "RP2":`` arm that ``test_wizard_accepts_rpipico_board``
exercises on the True side. Without an interactive wizard test that
reaches those elifs with a non-RP2 platform, the False side stayed
uncovered and codecov flagged the line as a partial branch.

Add ``test_wizard_accepts_default_answers_bk72xx`` — same fixture shape
as the existing ESP32 / ESP8266 variants — so the BK72XX path
falls through the RP2 elifs and pins both branches.
This commit is contained in:
Jesse Hills
2026-06-25 14:18:52 +12:00
parent 120a38a2d0
commit 1832d023d7
+28
View File
@@ -476,6 +476,34 @@ def test_wizard_accepts_default_answers_esp32(
assert retval == 0
def test_wizard_accepts_default_answers_bk72xx(
tmp_path: Path, monkeypatch: MonkeyPatch, wizard_answers: list[str]
):
"""
The wizard should accept the given default answers for bk72xx. The
libretiny branch also exercises the False side of the
``elif platform == "RP2":`` checks in the platform / board-link
elif chain (without this, those branches show as partial coverage
because only the rpipico interactive test reaches them with platform
== "RP2").
"""
# Given
wizard_answers[1] = "BK72XX"
wizard_answers[2] = next(iter(BK72XX_BOARD_PINS))
config_file = tmp_path / "test.yaml"
input_mock = MagicMock(side_effect=wizard_answers)
monkeypatch.setattr("builtins.input", input_mock)
monkeypatch.setattr(wz, "safe_print", lambda t=None, end=None: 0)
monkeypatch.setattr(wz, "sleep", lambda _: 0)
monkeypatch.setattr(wz, "wizard_write", MagicMock())
# When
retval = wz.wizard(config_file)
# Then
assert retval == 0
def test_wizard_offers_better_node_name(
tmp_path: Path, monkeypatch: MonkeyPatch, wizard_answers: list[str]
):