scripts: twister: harness: pytest: add support for custom cmd line args

Add support for passing custom command line arguments to a pytest
harness in twister.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
This commit is contained in:
Henrik Brix Andersen 2022-02-24 12:45:29 +01:00 committed by Anas Nashif
commit 7249dab0c8
3 changed files with 19 additions and 1 deletions

View file

@ -131,11 +131,13 @@ class Pytest(Harness):
self.running_dir = instance.build_dir
self.source_dir = instance.testcase.source_dir
self.pytest_root = 'pytest'
self.pytest_args = []
self.is_pytest = True
config = instance.testcase.harness_config
if config:
self.pytest_root = config.get('pytest_root', 'pytest')
self.pytest_args = config.get('pytest_args', [])
def handle(self, line):
''' Test cases that make use of pytest more care about results given
@ -164,6 +166,9 @@ class Pytest(Harness):
'-q'
]
for arg in self.pytest_args:
cmd.append(arg)
log = open(log_file, "a")
outs = []
errs = []