twister: harness: pytest: Check exist of the runner_params

Pytest harness in Twister tries to get custom parameters to
the pytest harnesses. It is required although those do not exist
(e.g. Twister uses devices without hw map). This change checks
if the custom parameters to the pytest harnesses exists.

Fixes #71817

Signed-off-by: Katarzyna Giądła <katarzyna.giadla@nordicsemi.no>
This commit is contained in:
Katarzyna Giądła 2024-04-23 15:54:01 +02:00 committed by Alberto Escolar
commit fe5a5edfc8
2 changed files with 6 additions and 4 deletions

View file

@ -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')

View file

@ -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}')