Hi Alex,

Please check the comments inline.

On 12/18/23 16:41, Alexander Kanavin wrote:
CAUTION: This email comes from a non Wind River email account!
Do not click links or open attachments unless you recognize the sender and know 
the content is safe.

Wait. There were two specific review requests, and both remain
unanswered. You are just resending the patch, and that is not
acceptable.

- (from Ross) can we use pytest —automake instead of unreadable
sed/awk monster expression?

A: Will use pytest --automake in v3.

- (from me) is ptest returning a non-zero error code when it fails
like the commit says? If it does, why isn't the failure seen when
running -c testimage, or in the autobuilder which does that?

Yes, the pytest command should return non-zero as below:
 # ./run-ptest
 [snip]

PASS: tests/test_license_expression.py:CombineExpressionTest.test_combine_expressions_with_duplicated_elements PASS: tests/test_license_expression.py:CombineExpressionTest.test_combine_expressions_with_empty_input PASS: tests/test_license_expression.py:CombineExpressionTest.test_combine_expressions_with_or_relationship PASS: tests/test_license_expression.py:CombineExpressionTest.test_combine_expressions_with_regular

self = <test_skeleton_codestyle.BaseTests testMethod=test_skeleton_codestyle>

    def test_skeleton_codestyle(self):
        """
        This test shouldn't run in proliferated repositories.
        """
        setup_cfg = configparser.ConfigParser()
        setup_cfg.read("setup.cfg")
>       if setup_cfg["metadata"]["name"] != "skeleton":

tests/test_skeleton_codestyle.py:22:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <configparser.ConfigParser object at 0x7f6e46e36e90>, key = 'metadata'

    def __getitem__(self, key):
        if key != self.default_section and not self.has_section(key):
>           raise KeyError(key)
E           KeyError: 'metadata'

../../python3.11/configparser.py:979: KeyError
FAIL: tests/test_skeleton_codestyle.py:BaseTests.test_skeleton_codestyle
============================================================================
Testsuite summary
# TOTAL: 175
# PASS: 174
# SKIP: 0
# XFAIL: 0
# FAIL: 1
# XPASS: 0
# ERROR: 0

# echo $?
1

Thanks,


Please do check these first, and please do pay attention to what people ask.

Alex



On Mon, 18 Dec 2023 at 07:15, <mingli...@windriver.com> wrote:

From: Mingli Yu <mingli...@windriver.com>

Fix the below ptest failure:
  self = <test_skeleton_codestyle.BaseTests testMethod=test_skeleton_codestyle>
  def test_skeleton_codestyle(self):
  """
  This test shouldn't run in proliferated repositories.
  """
  setup_cfg = configparser.ConfigParser()
  setup_cfg.read("setup.cfg")
  > if setup_cfg["metadata"]["name"] != "skeleton":
  tests/test_skeleton_codestyle.py:22:
  self = <configparser.ConfigParser object at 0x7fd87cf55110>, key = 'metadata'
  def _getitem_(self, key):
  if key != self.default_section and not self.has_section(key):
  > raise KeyError(key)
  E KeyError: 'metadata'

After the patch:
  # ./run-ptest
  [snip]
  PASS: 
tests/test_license_expression.py::LicensingValidateTest::test_validation_bad_syntax
  PASS: 
tests/test_license_expression.py::LicensingValidateTest::test_validation_exception_as_regular_key
  PASS: 
tests/test_license_expression.py::LicensingValidateTest::test_validation_exception_with_choice
  PASS: 
tests/test_license_expression.py::LicensingValidateTest::test_validation_invalid_license_exception
  PASS: 
tests/test_license_expression.py::LicensingValidateTest::test_validation_invalid_license_exception_strict_false
  PASS: 
tests/test_license_expression.py::LicensingValidateTest::test_validation_invalid_license_key
  PASS: tests/test_license_expression.py::UtilTest::test_build_licensing
  PASS: tests/test_license_expression.py::UtilTest::test_build_spdx_licensing
  PASS: tests/test_license_expression.py::UtilTest::test_get_license_key_info
  PASS: 
tests/test_license_expression.py::UtilTest::test_get_license_key_info_vendored
  PASS: 
tests/test_license_expression.py::CombineExpressionTest::test_combine_expressions_with_duplicated_elements
  PASS: 
tests/test_license_expression.py::CombineExpressionTest::test_combine_expressions_with_empty_input
  PASS: 
tests/test_license_expression.py::CombineExpressionTest::test_combine_expressions_with_or_relationship
  PASS: 
tests/test_license_expression.py::CombineExpressionTest::test_combine_expressions_with_regular
  PASS: tests/test_skeleton_codestyle.py::BaseTests::test_skeleton_codestyle

  ============================= 175 passed in 10.36s 
=============================

Signed-off-by: Mingli Yu <mingli...@windriver.com>
---
  .../python/python3-license-expression/run-ptest             | 6 +++++-
  .../python/python3-license-expression_30.1.1.bb             | 1 +
  2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/meta/recipes-devtools/python/python3-license-expression/run-ptest 
b/meta/recipes-devtools/python/python3-license-expression/run-ptest
index 5cec711696..07e2dd17ee 100644
--- a/meta/recipes-devtools/python/python3-license-expression/run-ptest
+++ b/meta/recipes-devtools/python/python3-license-expression/run-ptest
@@ -1,3 +1,7 @@
  #!/bin/sh

-pytest
+rm -rf output.log
+pytest -o log_cli=true -o log_cli_level=INFO > output.log 2>&1
+exitcode=$?
+cat output.log | sed -e 's/\[...%\]//g'| sed -e 's/PASSED/PASS/g'| sed -e 's/FAILED/FAIL/g'|sed -e 's/SKIPED/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}}'
+exit $exitcode
diff --git a/meta/recipes-devtools/python/python3-license-expression_30.1.1.bb 
b/meta/recipes-devtools/python/python3-license-expression_30.1.1.bb
index 31fb88d6e5..5d3923d487 100644
--- a/meta/recipes-devtools/python/python3-license-expression_30.1.1.bb
+++ b/meta/recipes-devtools/python/python3-license-expression_30.1.1.bb
@@ -33,4 +33,5 @@ do_install_ptest() {
      install -d ${D}${PTEST_PATH}/src
      cp -rf ${S}/tests/* ${D}${PTEST_PATH}/tests/
      cp -rf ${S}/src/* ${D}${PTEST_PATH}/src/
+    cp -rf ${S}/setup.cfg ${D}${PTEST_PATH}/
  }
--
2.25.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#192620): 
https://lists.openembedded.org/g/openembedded-core/message/192620
Mute This Topic: https://lists.openembedded.org/mt/103238401/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to