]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
test/py: fix runtest wrapper for pytest 6
authorStephen Warren <swarren@wwwdotorg.org>
Sun, 31 Jan 2021 03:12:18 +0000 (20:12 -0700)
committerTom Rini <trini@konsulko.com>
Mon, 1 Feb 2021 21:33:02 +0000 (16:33 -0500)
The implementation of pytest_runtest_protocol() must call
pytest_runtest_logstart() and pytest_runtest_logfinish(). This appears to
be necessary even in pytest 5.2.1 judging by the default version of
pytest_runtest_protocol(), but evidently some form of code reorganization
in pytest only made this have a practical effect in the newer version. I'd
previously been under the impression that 100% of the required work of
pytest_runtest_protocol() was handled by the fact it called
runtestprotocol() as its implementation. However, it appears that custom
implementations do need to do a little more than this.

Reported-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
test/py/conftest.py

index dc92c0be32ee0929ab7b6c49db96beb93ca6b88f..9bfd9263455f33a50173cf6c7a30f7b5c73d0b27 100644 (file)
@@ -554,7 +554,10 @@ def pytest_runtest_protocol(item, nextitem):
     """
 
     log.get_and_reset_warning()
+    ihook = item.ihook
+    ihook.pytest_runtest_logstart(nodeid=item.nodeid, location=item.location)
     reports = runtestprotocol(item, nextitem=nextitem)
+    ihook.pytest_runtest_logfinish(nodeid=item.nodeid, location=item.location)
     was_warning = log.get_and_reset_warning()
 
     # In pytest 3, runtestprotocol() may not call pytest_runtest_setup() if
@@ -623,4 +626,4 @@ def pytest_runtest_protocol(item, nextitem):
     if failure_cleanup:
         console.cleanup_spawn()
 
-    return reports
+    return True