[U-Boot] [PATCH 4/6] test/py: print implicit shell prompt later

Stephen Warren swarren at wwwdotorg.org
Wed Nov 18 04:20:02 CET 2015


Whenever a test is about to start, the test scripts log an "implicit"
version of the shell prompt. This ensures that each test's log section
includes the prompt, which makes it easier to read.

However, pytest apparently doesn't set up stdout capturing for skipped
tests. If we print this implicit prompt before we've determined whether
the test is skipped, then it may/will appear as stdout in ther terminal
where the test script was run, which looks messy.

To avoid this, only print this prompt after we've evaluated whether the
test is to be skipped. Note that internally, pytest.skip() raises an
exception, which causes the moved code not to execute, now that it's
later in the execution path.

Signed-off-by: Stephen Warren <swarren at wwwdotorg.org>
---
 test/py/conftest.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/test/py/conftest.py b/test/py/conftest.py
index 27f6f4d69c15..7d11278b5f65 100644
--- a/test/py/conftest.py
+++ b/test/py/conftest.py
@@ -184,11 +184,11 @@ def setup_envspec(item):
 
 def pytest_runtest_setup(item):
     log.start_section(item.name)
-    if console.at_prompt:
-        console.logstream.write(console.prompt, implicit=True)
     setup_boardspec(item)
     setup_buildconfigspec(item)
     setup_envspec(item)
+    if console.at_prompt:
+        console.logstream.write(console.prompt, implicit=True)
 
 def pytest_runtest_protocol(item, nextitem):
     reports = runtestprotocol(item, nextitem=nextitem)
-- 
1.9.1



More information about the U-Boot mailing list