twister: pytest hardware adapter ignores hardware map `probe_id` entry
Author: gschwaerCreated Jul 2, 2026Updated Sep 18, 2026
Labelspriority: lowarea: Twister
Describe the bug
The Twister documentation describes how the hardware map entry probe_id can be used to override a board identifier for flashing when using external probes^1. This does not work with the pytest harness.
The pytest hardware adapter should generate a flash command using probe_id as the board identifier, e.g. --board-id probe-id.
Regression
- This is a regression.
Steps to reproduce
I wrote a small test case (no real hardware needed):
- Download this patch and move into zephyr folder: 0001-test-probe-id-for-pytest-harness.patch
git apply 0001-test-probe-id-for-pytest-harness.patchwest twister -p native_sim --device-testing --hardware-map hardware-map.yml -T samples/basic/minimal- Observe failure because twister passes the
dut-idto pyOCD instead ofprobe-id.
Relevant log output
[...]
=================================== FAILURES ===================================
__________________ test_pytest_hardware_adapter_uses_probe_id __________________
unlaunched_dut = <twister_harness.device.hardware_adapter.HardwareAdapter object at 0x7c62560fc9b0>
def test_pytest_hardware_adapter_uses_probe_id(unlaunched_dut):
unlaunched_dut.generate_command()
print(unlaunched_dut.command)
command = [str(part) for part in unlaunched_dut.command]
board_id = command[command.index("--board-id") + 1]
> assert board_id == "probe-id"
E AssertionError: assert 'dut-id' == 'probe-id'
E
E - probe-id
E + dut-id
samples/basic/minimal/pytest/test_probe_id.py:7: AssertionError
[...]Impact
Functional Limitation – Some features not working as expected, but system usable.
Environment
Zephyr: 5967ceb85f0 (kernel: init: register CPU object core via K_OBJ_TYPE_DEFINE, 2026-06-29)
Additional Context
I would be willing to work on a PR for fixing the pytest harness to correctly handle probe_id, if that is an acceptable solution.
Source: zephyrproject-rtos/zephyr