From: Babanpreet Singh <bbnpreetsingh@gmail.com>
To: openembedded-core@lists.openembedded.org
Cc: Trevor Gamblin <tgamblin@baylibre.com>,
Ross Burton <ross.burton@arm.com>,
Babanpreet Singh <bbnpreetsingh@gmail.com>
Subject: [PATCH] python3-pygobject: add ptest support
Date: Sat, 14 Nov 2026 19:03:30 +0000 [thread overview]
Message-ID: <20261114190330.7-1-bbnpreetsingh@gmail.com> (raw)
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
diff --git a/meta/conf/distro/include/ptest-packagelists.inc b/meta/conf/distro/include/ptest-packagelists.inc
index bef45bb4d5..77e03b33b1 100644
--- a/meta/conf/distro/include/ptest-packagelists.inc
+++ b/meta/conf/distro/include/ptest-packagelists.inc
@@ -93,6 +93,7 @@ PTESTS_FAST = "\
python3-pluggy \
python3-pefile \
python3-pyasn1 \
+ python3-pygobject \
python3-pyopenssl \
python3-pyyaml \
python3-rpds-py \
diff --git a/meta/recipes-devtools/python/python3-pygobject/run-ptest b/meta/recipes-devtools/python/python3-pygobject/run-ptest
new file mode 100755
index 0000000000..47fab21c9c
--- /dev/null
+++ b/meta/recipes-devtools/python/python3-pygobject/run-ptest
@@ -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
diff --git a/meta/recipes-devtools/python/python3-pygobject_3.58.1.bb b/meta/recipes-devtools/python/python3-pygobject_3.58.1.bb
index 82089c2ad7..069a313735 100644
--- a/meta/recipes-devtools/python/python3-pygobject_3.58.1.bb
+++ b/meta/recipes-devtools/python/python3-pygobject_3.58.1.bb
@@ -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 = ""
--
2.43.0
reply other threads:[~2026-11-14 19:03 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261114190330.7-1-bbnpreetsingh@gmail.com \
--to=bbnpreetsingh@gmail.com \
--cc=openembedded-core@lists.openembedded.org \
--cc=ross.burton@arm.com \
--cc=tgamblin@baylibre.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox