test/py: fix runtest wrapper for pytest 6
PATCH v2 1/1 test/py: fix runtest wrapper for pytest 6
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.
---
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(-)
test/py/conftest.py +4 -1
@@ -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
Signature · 1 line
2.25.1
PATCH v2 1/1 test/py: fix runtest wrapper for pytest 6
Quoted 11 lines · Stephen Warren
The implementation of
pytest_runtest_protocol()must callpytest_runtest_logstart()andpytest_runtest_logfinish(). This appears to be necessary even in pytest 5.2.1 judging by the default version ofpytest_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 ofpytest_runtest_protocol()was handled by the fact it calledruntestprotocol()as its implementation. However, it appears that custom implementations do need to do a little more than this.
Quoted 9 lines
Reported-by Heinrich Schuchardt <[email protected]>Signed-off-by Stephen Warren <[email protected]>---
v2: Rebased on a marginally newer commit, hence removed the change totest/py/test.py. Cleaned up return statement.--- test/py/conftest.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
PATCH v2 1/1 test/py: fix runtest wrapper for pytest 6
In reply to Stephen WarrenQuoted 10 lines · Stephen Warren
The implementation of
pytest_runtest_protocol()must callpytest_runtest_logstart()andpytest_runtest_logfinish(). This appears to be necessary even in pytest 5.2.1 judging by the default version ofpytest_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 ofpytest_runtest_protocol()was handled by the fact it calledruntestprotocol()as its implementation. However, it appears that custom implementations do need to do a little more than this.
Quoted 3 lines
Reported-by Heinrich Schuchardt <[email protected]>Signed-off-by Stephen Warren <[email protected]>Reviewed-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
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>