diff --git a/scripts/pylib/pytest-twister-harness/src/twister_harness/device/hardware_adapter.py b/scripts/pylib/pytest-twister-harness/src/twister_harness/device/hardware_adapter.py index ef25d58cd7d..21d9c7378e4 100644 --- a/scripts/pylib/pytest-twister-harness/src/twister_harness/device/hardware_adapter.py +++ b/scripts/pylib/pytest-twister-harness/src/twister_harness/device/hardware_adapter.py @@ -66,8 +66,9 @@ class HardwareAdapter(DeviceAdapter): extra_args: list[str] = [] runner = self.device_config.runner base_args.extend(['--runner', runner]) - for param in self.device_config.runner_params: - extra_args.append(param) + if self.device_config.runner_params: + for param in self.device_config.runner_params: + extra_args.append(param) if board_id := self.device_config.id: if runner == 'pyocd': extra_args.append('--board-id') diff --git a/scripts/pylib/twister/twisterlib/harness.py b/scripts/pylib/twister/twisterlib/harness.py index b65fa7cfada..d299c98c8e6 100644 --- a/scripts/pylib/twister/twisterlib/harness.py +++ b/scripts/pylib/twister/twisterlib/harness.py @@ -382,8 +382,9 @@ class Pytest(Harness): if runner := hardware.runner or options.west_runner: command.append(f'--runner={runner}') - for param in hardware.runner_params: - command.append(f'--runner-params={param}') + if hardware.runner_params: + for param in hardware.runner_params: + command.append(f'--runner-params={param}') if options.west_flash and options.west_flash != []: command.append(f'--west-flash-extra-args={options.west_flash}')