All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] test/py: fix runtest wrapper for pytest 6
@ 2021-01-31  3:12 Stephen Warren
  2021-02-01 20:44 ` Simon Glass
  2021-02-02 14:31 ` Tom Rini
  0 siblings, 2 replies; 3+ messages in thread
From: Stephen Warren @ 2021-01-31  3:12 UTC (permalink / raw)
  To: u-boot

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>
---
v2: Rebased on a marginally newer commit, hence removed the change to
test/py/test.py. Cleaned up return statement.
---
 test/py/conftest.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/test/py/conftest.py b/test/py/conftest.py
index dc92c0be32ee..9bfd9263455f 100644
--- a/test/py/conftest.py
+++ b/test/py/conftest.py
@@ -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
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH v2] test/py: fix runtest wrapper for pytest 6
  2021-01-31  3:12 [PATCH v2] test/py: fix runtest wrapper for pytest 6 Stephen Warren
@ 2021-02-01 20:44 ` Simon Glass
  2021-02-02 14:31 ` Tom Rini
  1 sibling, 0 replies; 3+ messages in thread
From: Simon Glass @ 2021-02-01 20:44 UTC (permalink / raw)
  To: u-boot

On Sat, 30 Jan 2021 at 20:12, Stephen Warren <swarren@wwwdotorg.org> wrote:
>
> 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>
> ---
> v2: Rebased on a marginally newer commit, hence removed the change to
> test/py/test.py. Cleaned up return statement.
> ---
>  test/py/conftest.py | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>

Reviewed-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v2] test/py: fix runtest wrapper for pytest 6
  2021-01-31  3:12 [PATCH v2] test/py: fix runtest wrapper for pytest 6 Stephen Warren
  2021-02-01 20:44 ` Simon Glass
@ 2021-02-02 14:31 ` Tom Rini
  1 sibling, 0 replies; 3+ messages in thread
From: Tom Rini @ 2021-02-02 14:31 UTC (permalink / raw)
  To: u-boot

On Sat, Jan 30, 2021 at 08:12:18PM -0700, Stephen Warren wrote:

> 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>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210202/9629e953/attachment.sig>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-02-02 14:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-31  3:12 [PATCH v2] test/py: fix runtest wrapper for pytest 6 Stephen Warren
2021-02-01 20:44 ` Simon Glass
2021-02-02 14:31 ` Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.