Now I have modified the output of pytest by modifying ptest-runner. My solution is that if OSS uses pytest testing, name its ptest file run-ptest-pytest.
The content of run-ptest-pytest is as follows: pytest -o log_cli = true -o log_cli_level = INFO The test output is as follows: START: ptest-runner 2020-05-18T05:42 BEGIN: /usr/lib/python3-parse-type/ptest ============================= test session starts ============================== platform linux -- Python 3.8.2, pytest-5.3.5, py-1.8.1, pluggy-0.13.1 rootdir: /usr/lib/python3-parse-type/ptest collected 192 items PASS: tests/test_builder.py::TestTypeBuilder4Enum::test_make_enum_with_dict PASS: tests/test_builder.py::TestTypeBuilder4Enum::test_make_enum_with_enum_class PASS: tests/test_builder.py::TestTypeBuilder4Enum::test_parse_enum_yesno ... PASS: tests/test_parse_util.py::TestFieldParser::test_extract_types PASS: tests/test_parse_util.py::TestFieldParser::test_parse__raises_error_with_missing_or_partial_br PASS: tests/test_parse_util.py::TestFieldParser::test_parse__with_valid_fields ============================= 192 passed in 18.41s ============================= STOP: ptest-runner DURATION: 32 END: /usr/lib/python3-parse-type/ptest 2020-05-18T05:42 STOP: ptest-runner -----邮件原件----- 发件人: Richard Purdie <[email protected]> 发送时间: 2020年5月13日 5:23 收件人: Zang, Ruochen/臧 若尘 <[email protected]>; [email protected] 抄送: Tim Orling <[email protected]> 主题: Re: [oe] [meta-python] [PATCH] python3-parse-type: Modify ptest output format On Tue, 2020-05-12 at 22:23 +0800, zangrc wrote: > Signed-off-by: Zang Ruochen <[email protected]> > --- > .../recipes-devtools/python/python3-parse-type/run-ptest | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git > a/meta-python/recipes-devtools/python/python3-parse-type/run-ptest > b/meta-python/recipes-devtools/python/python3-parse-type/run-ptest > index 5cec71169..b63c4de0d 100644 > --- a/meta-python/recipes-devtools/python/python3-parse-type/run-ptest > +++ b/meta-python/recipes-devtools/python/python3-parse-type/run-ptest > @@ -1,3 +1,3 @@ > #!/bin/sh > > -pytest > +pytest -o log_cli=true -o log_cli_level=INFO | sed -e 's/\[...%\]//g'| sed > -e 's/PASSED/PASS/g'| sed -e 's/FAILED/FAIL/g'|sed -e 's/SKIPPED/SKIP/g'| awk > '{if ($NF=="PASS" || $NF=="FAIL" || $NF=="SKIP" || $NF=="XFAIL" || > $NF=="XPASS"){printf "%s: %s\n", $NF, $0}else{print}}'| awk '{if ($NF=="PASS" > || $NF=="FAIL" || $NF=="SKIP" || $NF=="XFAIL" || $NF=="XPASS") {$NF="";print > $0}else{print}}' Rather than doing this for every python module, it may be an idea to consider: a) teaching ptest runner how to handle the alternate output format (triggered by run-ptest-XXX instead of run-ptest) or b) adding a common python script which could avoid all this sed/awk magic and the extra dependencies or c) patch in a parameter to pytest which outputs the data in the format we need. Cheers, Richard
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#84413): https://lists.openembedded.org/g/openembedded-devel/message/84413 Mute This Topic: https://lists.openembedded.org/mt/74286062/21656 Group Owner: [email protected] Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
