diff mbox series

python3-six: add ptest support

Message ID 20260910090351.2723224-1-HimaniRamesh.Barde@windriver.com
State New
Headers show
Series python3-six: add ptest support | expand

Commit Message

Himani Ramesh Barde Sept. 10, 2026, 9:03 a.m. UTC
Enable ptest for python3-six using the ptest-python-pytest class, which
runs the upstream test_six.py suite via pytest and emits automake-style
PASS/FAIL results.

six ships its test at the sdist root, so PTEST_PYTEST_DIR is set to "."
and do_install_ptest is extended to install only test_six.py plus the
generated run-ptest, dropping the packaged library sources and bytecode
cache so the ptest package stays minimal and reproducible.

test_six.py exercises the six.moves mappings, which import the html,
http.server and xmlrpc modules that oe-core packages separately, so
python3-html, python3-netclient and python3-xmlrpc are added to
RDEPENDS:${PN}-ptest. The recipe is also registered in
ptest-packagelists.inc.

Validated on qemux86-64: 183 passed, 17 skipped, 0 failed.

Signed-off-by: Himani Ramesh Barde <HimaniRamesh.Barde@windriver.com>
---
 .../distro/include/ptest-packagelists.inc     |  1 +
 .../python/python3-six_1.17.0.bb              | 21 ++++++++++++++++++-
 2 files changed, 21 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/meta/conf/distro/include/ptest-packagelists.inc b/meta/conf/distro/include/ptest-packagelists.inc
index 4012be5..2b5d665 100644
--- a/meta/conf/distro/include/ptest-packagelists.inc
+++ b/meta/conf/distro/include/ptest-packagelists.inc
@@ -90,6 +90,7 @@  PTESTS_FAST = "\
     python3-pytz \
     python3-pyyaml \
     python3-rpds-py \
+    python3-six \
     python3-trove-classifiers \
     python3-vcs-versioning \
     python3-uritools \
diff --git a/meta/recipes-devtools/python/python3-six_1.17.0.bb b/meta/recipes-devtools/python/python3-six_1.17.0.bb
index 693f181..ca120e0 100644
--- a/meta/recipes-devtools/python/python3-six_1.17.0.bb
+++ b/meta/recipes-devtools/python/python3-six_1.17.0.bb
@@ -1,4 +1,23 @@ 
-inherit setuptools3
+inherit setuptools3 ptest-python-pytest
 require python-six.inc
 
 SRC_URI[sha256sum] = "ff70335d468e7eb6ec65b95b99d3a2836546063f63acc5171de367e834932a81"
+
+PTEST_PYTEST_DIR = "."
+
+# test_six.py exercises the six.moves mappings, which import these stdlib
+# modules that are packaged separately in oe-core.
+RDEPENDS:${PN}-ptest += " \
+    python3-html \
+    python3-netclient \
+    python3-xmlrpc \
+"
+
+do_install_ptest:append() {
+    # six ships its test at the sdist root; keep only test_six.py plus the
+    # generated run-ptest, and drop the packaged library sources / bytecode.
+    rm -f  ${D}${PTEST_PATH}/six.py
+    rm -f  ${D}${PTEST_PATH}/setup.py ${D}${PTEST_PATH}/setup.cfg ${D}${PTEST_PATH}/MANIFEST.in
+    rm -f  ${D}${PTEST_PATH}/CHANGES ${D}${PTEST_PATH}/README.rst ${D}${PTEST_PATH}/PKG-INFO ${D}${PTEST_PATH}/LICENSE
+    rm -rf ${D}${PTEST_PATH}/build ${D}${PTEST_PATH}/documentation ${D}${PTEST_PATH}/six.egg-info ${D}${PTEST_PATH}/__pycache__
+}