From fc10f16a2e9203c3dfce55c4ed7694ddd1c738eb Mon Sep 17 00:00:00 2001 From: David Reiss Date: Thu, 19 Jan 2023 15:52:37 -0800 Subject: [PATCH 1/2] pytest: Fix typo in comment in pytest suite The option is "cmdopt" Signed-off-by: David Reiss --- samples/subsys/testsuite/pytest/pytest/conftest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/subsys/testsuite/pytest/pytest/conftest.py b/samples/subsys/testsuite/pytest/pytest/conftest.py index a21762c910342..75b5c58527308 100644 --- a/samples/subsys/testsuite/pytest/pytest/conftest.py +++ b/samples/subsys/testsuite/pytest/pytest/conftest.py @@ -4,7 +4,7 @@ import pytest -# add option "--comdopt" to pytest, or it will report "unknown option" +# add option "--cmdopt" to pytest, or it will report "unknown option" # this option is passed from twister. def pytest_addoption(parser): parser.addoption( From 1341166d028acbab9ed85153ca170187fc1a51c6 Mon Sep 17 00:00:00 2001 From: David Reiss Date: Thu, 19 Jan 2023 15:52:45 -0800 Subject: [PATCH 2/2] pytest: Log pytest command This makes it easy to run the command manually, possibly with edits to change the test behavior. Signed-off-by: David Reiss --- scripts/pylib/twister/twisterlib/harness.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/pylib/twister/twisterlib/harness.py b/scripts/pylib/twister/twisterlib/harness.py index 814b1a0eb3a64..ff2bd9735c1f6 100644 --- a/scripts/pylib/twister/twisterlib/harness.py +++ b/scripts/pylib/twister/twisterlib/harness.py @@ -3,6 +3,7 @@ import re import os import subprocess +import shlex from collections import OrderedDict import xml.etree.ElementTree as ET import logging @@ -207,6 +208,9 @@ def pytest_run(self, log_file): outs = [] errs = [] + logger.debug( + "Running pytest command: %s", + " ".join(shlex.quote(a) for a in cmd)) with subprocess.Popen(cmd, stdout = subprocess.PIPE, stderr = subprocess.PIPE) as proc: