@@ -93,6 +93,7 @@ PTESTS_FAST = "\
python3-pluggy \
python3-pefile \
python3-pyasn1 \
+ python3-pygobject \
python3-pyopenssl \
python3-pyyaml \
python3-rpds-py \
new file mode 100755
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+export LD_LIBRARY_PATH=$PWD/../gi-tests
+export GI_TYPELIB_PATH=$PWD/../gi-tests
+export GSETTINGS_SCHEMA_DIR=$PWD/tests
+export GSETTINGS_BACKEND=memory
+
+pytest --automake
@@ -7,7 +7,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=91db794c3adc9d824d4eddabb341e816"
GIR_MESON_OPTION = ""
-inherit gnomebase setuptools3-base gobject-introspection upstream-version-is-even
+inherit gnomebase setuptools3-base gobject-introspection upstream-version-is-even ptest-python-pytest
python() {
if d.getVar('CLASSOVERRIDE') == "class-target" and not bb.utils.to_boolean(d.getVar("GI_DATA_ENABLED")):
@@ -19,11 +19,13 @@ DEPENDS += "python3 glib-2.0"
GNOME_COMPRESS_TYPE = "gz"
GNOMEBN = "pygobject"
+SRC_URI += "file://run-ptest"
SRC_URI[archive.sha256sum] = "4c80598ade17fbaa7798e01a25d0bf29ce109740786026a074c5c62bb3e79d23"
S = "${UNPACKDIR}/${GNOMEBN}-${PV}"
-PACKAGECONFIG ??= "${@bb.utils.contains_any('DISTRO_FEATURES', [ 'directfb', 'wayland', 'x11' ], 'cairo', '', d)}"
+PACKAGECONFIG ??= "${@bb.utils.contains_any('DISTRO_FEATURES', [ 'directfb', 'wayland', 'x11' ], 'cairo', '', d)} \
+ ${@bb.utils.contains('PTEST_ENABLED', '1', 'tests', '', d)}"
RDEPENDS:${PN} += " \
python3-asyncio \
@@ -35,7 +37,26 @@ RDEPENDS:${PN} += " \
# python3-pycairo is checked on configuration -> DEPENDS
# we don't link against python3-pycairo -> RDEPENDS
PACKAGECONFIG[cairo] = "-Dpycairo=enabled,-Dpycairo=disabled, cairo python3-pycairo, python3-pycairo"
-PACKAGECONFIG[tests] = "-Dtests=true,-Dtests=false,"
+# do_install_ptest_base cleans PTEST_PATH, so the test libraries go next to it
+PACKAGECONFIG[tests] = "-Dtests=true -Dgobject-introspection-tests:install_dir=${libdir}/${BPN}/gi-tests,-Dtests=false,"
+
+do_install_ptest:append() {
+ rm -f ${D}${PTEST_PATH}/tests/*.c ${D}${PTEST_PATH}/tests/*.h ${D}${PTEST_PATH}/tests/meson.build
+ install -m 0644 ${S}/pyproject.toml ${D}${PTEST_PATH}/
+ install -m 0644 ${B}/tests/gschemas.compiled ${D}${PTEST_PATH}/tests/
+ install -m 0755 ${B}/tests/testhelper*.so ${D}${PTEST_PATH}/tests/
+}
+
+FILES:${PN}-ptest += "${libdir}/${BPN}/gi-tests"
+
+RDEPENDS:${PN}-ptest += " \
+ bash \
+ python3-ctypes \
+ python3-misc \
+ python3-pickle \
+ python3-unittest \
+"
+RDEPENDS:${PN}-ptest:append:libc-glibc = " glibc-gconv-iso8859-1"
BBCLASSEXTEND = "native"
PACKAGECONFIG:class-native = ""
Run the upstream pytest suite under ptest. The test libraries and typelibs come from the gobject-introspection-tests subproject that pygobject bundles, built through the 'tests' PACKAGECONFIG when ptest is enabled. Tested on qemux86-64 with ptest-runner: 1442 pass, 184 skip, 7 xfail, 0 fail. Most skips are Gtk, Gdk and Pango tests; those are not in the image. [YOCTO #15565] AI-Generated: Uses Claude (claude-fable-5-2) Signed-off-by: Babanpreet Singh <bbnpreetsingh@gmail.com> --- .../distro/include/ptest-packagelists.inc | 1 + .../python/python3-pygobject/run-ptest | 8 ++++++ .../python/python3-pygobject_3.58.1.bb | 27 ++++++++++++++++--- 3 files changed, 33 insertions(+), 3 deletions(-) create mode 100755 meta/recipes-devtools/python/python3-pygobject/run-ptest