diff mbox series

[meta-python,v2,1/2] python3-pykickstart: Add ptest support

Message ID 20250427023927.2504776-1-mingli.yu@eng.windriver.com
State Under Review
Headers show
Series [meta-python,v2,1/2] python3-pykickstart: Add ptest support | expand

Commit Message

mingli.yu@eng.windriver.com April 27, 2025, 2:39 a.m. UTC
From: Mingli Yu <mingli.yu@windriver.com>

 # ./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]

Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
---
 .../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
diff mbox series

Patch

diff --git a/meta-python/recipes-extended/python-pykickstart/files/run-ptest b/meta-python/recipes-extended/python-pykickstart/files/run-ptest
new file mode 100755
index 0000000000..289e68b054
--- /dev/null
+++ b/meta-python/recipes-extended/python-pykickstart/files/run-ptest
@@ -0,0 +1,3 @@ 
+#!/bin/sh
+
+pytest --automake --deselect tests/test_packages.py::AddGroupsAndEnvironment_TestCase --deselect tests/commands/test_reboot.py::Reboot_TestCase
diff --git a/meta-python/recipes-extended/python-pykickstart/python3-pykickstart_3.63.bb b/meta-python/recipes-extended/python-pykickstart/python3-pykickstart_3.63.bb
index bd20c69980..c701e361b7 100644
--- a/meta-python/recipes-extended/python-pykickstart/python3-pykickstart_3.63.bb
+++ b/meta-python/recipes-extended/python-pykickstart/python3-pykickstart_3.63.bb
@@ -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 -Rl unittest.main ${D}${PTEST_PATH}/tests/`; 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"