Skip to content

Commit

Permalink
warning
Browse files Browse the repository at this point in the history
  • Loading branch information
hmaerki committed Feb 25, 2025
1 parent 02fc364 commit c6b4b1a
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,20 @@ def get_required_futs() -> list[EnumFut]:
assert EnumFut(fut), fut

if "mcu" in metafunc.fixturenames:

def warning(
firmware_spec: FirmwareSpecBase | None,
futs: list[EnumFut],
) -> None:
msg = "No tentacle where selected"
if firmware_spec is not None:
msg += f" for testing firmware '{firmware_spec.board_variant}'"
msg += "."
if len(futs) > 0:
futs_text = ", ".join(f.name for f in _required_futs)
msg += f" Required futs: {futs_text}."
logger.warning(msg)

list_tentacles: list[TentacleShowcase] = []
for firmware_spec in get_firmware_specs(
config=metafunc.config,
Expand All @@ -99,9 +113,7 @@ def get_required_futs() -> list[EnumFut]:
)
tentacles = list(filter(firmware_spec.match_board, tentacles))
if len(tentacles) == 0:
futs_text = ", ".join(f.name for f in _required_futs)
msg = f"No tentacle where selected for testing firmware '{firmware_spec.board_variant}'. Required futs: {futs_text}"
logger.warning(msg)
warning(firmware_spec=firmware_spec, futs=_required_futs)
for tentacle in tentacles:
# TODO: This might be not required anymore!!!
# Need to create a copy to the tentacle as we
Expand All @@ -111,9 +123,7 @@ def get_required_futs() -> list[EnumFut]:
list_tentacles.append(tentacle)

if len(list_tentacles) == 0:
msg = f"No tentacle where selected for testing firmware '{firmware_spec.board_variant}'."
# raise ValueError(msg)
logger.warning(msg)
warning(firmware_spec=firmware_spec, futs=[])
return
# print(f"LEN={len(list_tentacles)}")
metafunc.parametrize("mcu", list_tentacles, ids=lambda t: t.pytest_id)
Expand Down

0 comments on commit c6b4b1a

Please sign in to comment.