Skip to contentSkip to conversation

python3-pykickstart: Add ptest support

PATCH Superseded [email protected] 3 participants 4 messages Apr 25, 2025 – Apr 27, 2025

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 python3-pykickstart: Add ptest support

From: Mingli Yu <[email protected]>

 # ./run-ptest
PASS: tests/commands/test_authconfig.py:FC3_TestCase.runTest
PASS: tests/commands/test_authconfig.py:F28_TestCase.runTest
PASS: tests/commands/test_authconfig.py:F35_TestCase.runTest
PASS: tests/commands/test_authselect.py:F28_TestCase.runTest
PASS: tests/commands/test_autopart.py:AutoPart_TestCase.runTest
PASS: tests/commands/test_autopart.py:FC3_TestCase.runTest
PASS: tests/commands/test_autopart.py:F9_TestCase.runTest
PASS: tests/commands/test_autopart.py:F12_TestCase.runTest
[snip]
---
 .../python-pykickstart/files/run-ptest         |  3 +++
 .../python3-pykickstart_3.63.bb                | 18 +++++++++++++++++-
 2 files changed, 20 insertions(+), 1 deletion(-)
 create mode 100755 meta-python/recipes-extended/python-pykickstart/files/run-ptest
meta-python/recipes-extended/python-pykickstart/files/run-ptest new file +3 -0
new file mode 100755
index 0000000000..289e68b054
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+pytest --automake --deselect tests/test_packages.py::AddGroupsAndEnvironment_TestCase --deselect tests/commands/test_reboot.py::Reboot_TestCase
meta-python/recipes-extended/python-pykickstart/python3-pykickstart_3.63.bb +17 -1
index bd20c69980..200e8838fb 100644
@@ -4,18 +4,34 @@ LICENSE = "GPL-2.0-or-later"
 
 LIC_FILES_CHKSUM = "file://COPYING;md5=81bcece21748c91ba9992349a91ec11d"
 
-inherit python_setuptools_build_meta
+inherit python_setuptools_build_meta ptest
 
 RDEPENDS:${PN} = "python3 \
                   python3-requests \
                   python3-six \
 "
 
+RDEPENDS:${PN}-ptest += " \
+    python3-pytest \
+    python3-unittest-automake-output \
+"
+
+do_install_ptest() {
+    install -d ${D}${PTEST_PATH}/tests
+    cp -rf ${S}/tests/* ${D}${PTEST_PATH}/tests
+    for file in `grep -Rn unittest.main ${D}${PTEST_PATH}/tests/* |  awk -F":" '{print $1}'`; do
+        dirname=`dirname $file`
+        basename=`basename $file`
+        [ $basename != "__init__.py" ] && mv $file ${dirname}/test_${basename}
+    done
+}
+
 SRC_URI = "git://github.com/rhinstaller/pykickstart.git;protocol=https;branch=master;tag=r${PV} \
            file://0001-support-authentication-for-kickstart.patch \
            file://0002-pykickstart-parser.py-add-lock-for-readKickstart-and.patch \
            file://0003-comment-out-sections-shutdown-and-environment-in-gen.patch \
            file://0004-load.py-retry-to-invoke-request-with-timeout.patch \
+           file://run-ptest \
            "
 SRCREV = "6e0d1238cb4696a9040072a5a28a706e5775c552"
 
Signature · 1 line
2.34.1
#1 lore raw

PATCH 2/2 ptest-packagelists-meta-python.inc: Add python3-pykickstart

From: Mingli Yu <[email protected]>

---
 meta-python/conf/include/ptest-packagelists-meta-python.inc | 1 +
 1 file changed, 1 insertion(+)
meta-python/conf/include/ptest-packagelists-meta-python.inc +1 -0
index f6a8129793..a1465dac7c 100644
@@ -117,6 +117,7 @@ PTESTS_SLOW_META_PYTHON = "\
     python3-marshmallow \
     python3-pillow \
     python3-pint \
+    python3-pykickstart \
     python3-pytest-localserver \
     python3-scrypt \
     python3-traitlets \
Signature · 1 line
2.34.1
#2 lore raw
In reply to [email protected]
Quoted 44 lines · Mingli via lists.openembedded.org

From: Mingli Yu <[email protected]>

 # ./run-ptest
PASS: tests/commands/test_authconfig.py:FC3_TestCase.runTest
PASS: tests/commands/test_authconfig.py:F28_TestCase.runTest
PASS: tests/commands/test_authconfig.py:F35_TestCase.runTest
PASS: tests/commands/test_authselect.py:F28_TestCase.runTest
PASS: tests/commands/test_autopart.py:AutoPart_TestCase.runTest
PASS: tests/commands/test_autopart.py:FC3_TestCase.runTest
PASS: tests/commands/test_autopart.py:F9_TestCase.runTest
PASS: tests/commands/test_autopart.py:F12_TestCase.runTest
[snip]
---
 .../python-pykickstart/files/run-ptest         |  3 +++
 .../python3-pykickstart_3.63.bb                | 18 +++++++++++++++++-
 2 files changed, 20 insertions(+), 1 deletion(-)
 create mode 100755 meta-python/recipes-extended/python-pykickstart/files/run-ptest
meta-python/recipes-extended/python-pykickstart/files/run-ptest new file +3 -0
new file mode 100755
index 0000000000..289e68b054
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+pytest --automake --deselect tests/test_packages.py::AddGroupsAndEnvironment_TestCase --deselect tests/commands/test_reboot.py::Reboot_TestCase
meta-python/recipes-extended/python-pykickstart/python3-pykickstart_3.63.bb +1 -1
index bd20c69980..200e8838fb 100644
@@ -4,18 +4,34 @@ LICENSE = "GPL-2.0-or-later"
 
 LIC_FILES_CHKSUM = "file://COPYING;md5=81bcece21748c91ba9992349a91ec11d"
 
-inherit python_setuptools_build_meta
+inherit python_setuptools_build_meta ptest
 
 RDEPENDS:${PN} = "python3 \
                   python3-requests \
                   python3-six \
 "

meta-python/recipes-extended/python-pykickstart/python3-pykickstart_3.63.bb LICENSE = "GPL-2.0-or-later" · line 22

Quoted 10 lines
meta-python/recipes-extended/python-pykickstart/python3-pykickstart_3.63.bb +9 -0
 
+RDEPENDS:${PN}-ptest += " \
+    python3-pytest \
+    python3-unittest-automake-output \
+"
+
+do_install_ptest() {
+    install -d ${D}${PTEST_PATH}/tests
+    cp -rf ${S}/tests/* ${D}${PTEST_PATH}/tests
+    for file in `grep -Rn unittest.main ${D}${PTEST_PATH}/tests/* |  awk -F":" '{print $1}'`; do

Isn't this whole grep+awk chain equivalent to
grep -Rl unittest.main ${D}${PTEST_PATH}/tests/ ? If yes, wouldn't this be more readable?

Quoted 24 lines
meta-python/recipes-extended/python-pykickstart/python3-pykickstart_3.63.bb +7 -1
+        dirname=`dirname $file`
+        basename=`basename $file`
+        [ $basename != "__init__.py" ] && mv $file ${dirname}/test_${basename}
+    done
+}
+
 SRC_URI = "git://github.com/rhinstaller/pykickstart.git;protocol=https;branch=master;tag=r${PV} \
            file://0001-support-authentication-for-kickstart.patch \
            file://0002-pykickstart-parser.py-add-lock-for-readKickstart-and.patch \
            file://0003-comment-out-sections-shutdown-and-environment-in-gen.patch \
            file://0004-load.py-retry-to-invoke-request-with-timeout.patch \
+           file://run-ptest \
            "
 SRCREV = "6e0d1238cb4696a9040072a5a28a706e5775c552"
 
 
-=-=-=-=-=-=-=-=-=-=-=-

Links: You receive all messages sent to this group.
View/Reply Online (#117123): https://lists.openembedded.org/g/openembedded-devel/message/117123
Mute This Topic: https://lists.openembedded.org/mt/112448367/6084445
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#3 lore raw
Quoted 49 lines · Gyorgy Sarvari

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.

Quoted 45 lines · Mingli via lists.openembedded.org

From: Mingli Yu <[email protected]>

  # ./run-ptest
PASS: tests/commands/test_authconfig.py:FC3_TestCase.runTest
PASS: tests/commands/test_authconfig.py:F28_TestCase.runTest
PASS: tests/commands/test_authconfig.py:F35_TestCase.runTest
PASS: tests/commands/test_authselect.py:F28_TestCase.runTest
PASS: tests/commands/test_autopart.py:AutoPart_TestCase.runTest
PASS: tests/commands/test_autopart.py:FC3_TestCase.runTest
PASS: tests/commands/test_autopart.py:F9_TestCase.runTest
PASS: tests/commands/test_autopart.py:F12_TestCase.runTest
[snip]
---
  .../python-pykickstart/files/run-ptest         |  3 +++
  .../python3-pykickstart_3.63.bb                | 18 +++++++++++++++++-
  2 files changed, 20 insertions(+), 1 deletion(-)

create mode 100755 meta-python/recipes-extended/python-pykickstart/files/run-ptest

meta-python/recipes-extended/python-pykickstart/files/run-ptest new file +3 -0
new file mode 100755
index 0000000000..289e68b054
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+pytest --automake --deselect tests/test_packages.py::AddGroupsAndEnvironment_TestCase --deselect tests/commands/test_reboot.py::Reboot_TestCase
meta-python/recipes-extended/python-pykickstart/python3-pykickstart_3.63.bb +1 -1
index bd20c69980..200e8838fb 100644
@@ -4,18 +4,34 @@ LICENSE = "GPL-2.0-or-later"
 
  LIC_FILES_CHKSUM = "file://COPYING;md5=81bcece21748c91ba9992349a91ec11d"
 
-inherit python_setuptools_build_meta
+inherit python_setuptools_build_meta ptest
 
  RDEPENDS:${PN} = "python3 \
                    python3-requests \
                    python3-six \
  "
 
Quoted 13 lines

meta-python/recipes-extended/python-pykickstart/python3-pykickstart_3.63.bb LICENSE = "GPL-2.0-or-later" · line 22

Quoted 9 lines
meta-python/recipes-extended/python-pykickstart/python3-pykickstart_3.63.bb +9 -0
+RDEPENDS:${PN}-ptest += " \
+    python3-pytest \
+    python3-unittest-automake-output \
+"
+
+do_install_ptest() {
+    install -d ${D}${PTEST_PATH}/tests
+    cp -rf ${S}/tests/* ${D}${PTEST_PATH}/tests
+    for file in `grep -Rn unittest.main ${D}${PTEST_PATH}/tests/* |  awk -F":" '{print $1}'`; do

Isn't this whole grep+awk chain equivalent to
grep -Rl unittest.main ${D}${PTEST_PATH}/tests/ ? If yes, wouldn't this be more readable?

Thanks! v2 is coming.

Thanks,
Mingli

Quoted 25 lines
Quoted 24 lines
meta-python/recipes-extended/python-pykickstart/python3-pykickstart_3.63.bb +7 -1
+        dirname=`dirname $file`
+        basename=`basename $file`
+        [ $basename != "__init__.py" ] && mv $file ${dirname}/test_${basename}
+    done
+}
+
  SRC_URI = "git://github.com/rhinstaller/pykickstart.git;protocol=https;branch=master;tag=r${PV} \
             file://0001-support-authentication-for-kickstart.patch \
             file://0002-pykickstart-parser.py-add-lock-for-readKickstart-and.patch \
             file://0003-comment-out-sections-shutdown-and-environment-in-gen.patch \
             file://0004-load.py-retry-to-invoke-request-with-timeout.patch \
+           file://run-ptest \
             "
  SRCREV = "6e0d1238cb4696a9040072a5a28a706e5775c552"
 
 
-=-=-=-=-=-=-=-=-=-=-=-

Links: You receive all messages sent to this group.
View/Reply Online (#117123): https://lists.openembedded.org/g/openembedded-devel/message/117123
Mute This Topic: https://lists.openembedded.org/mt/112448367/6084445
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-