diff mbox series

[meta-python,02/16] python3-filelock: fix ptest cache-dir permissions and missing tasks/pythonpath

Message ID 20260829001108.559544-2-khem.raj@oss.qualcomm.com
State New
Headers show
Series [meta-python,01/16] python3-bleak: fetch git tag with tests/ for ptest instead of PyPI sdist | expand

Commit Message

Khem Raj Aug. 29, 2026, 12:10 a.m. UTC
From: Khem Raj <raj.khem@gmail.com>

tests/ imports itself as "tests.*" and pulls in "capabilities" from
the sibling tasks/ dir; upstream's pyproject.toml sets
[tool.pytest] pythonpath = [".", "tasks"] to make both resolve, so
ship tasks/ and pyproject.toml into the ptest install too.

Also disable pytest's cache plugin: the non-root "tester" user ptest
runs as can't write a cache dir under the read-only-to-them
/usr/lib/python3-filelock/ptest install path.

Add python3-pytest-timeout, used by the test suite.

AI-Generated: Uses Claude Code
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../recipes-devtools/python/python3-filelock/run-ptest   | 4 +++-
 .../recipes-devtools/python/python3-filelock_3.32.4.bb   | 9 +++++++++
 2 files changed, 12 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/meta-python/recipes-devtools/python/python3-filelock/run-ptest b/meta-python/recipes-devtools/python/python3-filelock/run-ptest
index 88654deb70..fd1ddc5896 100644
--- a/meta-python/recipes-devtools/python/python3-filelock/run-ptest
+++ b/meta-python/recipes-devtools/python/python3-filelock/run-ptest
@@ -3,4 +3,6 @@ 
 # Some tests require non-root
 useradd tester || echo test user exists already
 
-su tester -c "pytest --automake"
+# tester can't write pytest's cache dir under the read-only-to-them
+# /usr/lib/python3-filelock/ptest install path; disable it, it's not needed
+su tester -c "pytest --automake -p no:cacheprovider"
diff --git a/meta-python/recipes-devtools/python/python3-filelock_3.32.4.bb b/meta-python/recipes-devtools/python/python3-filelock_3.32.4.bb
index 63ebb08b6e..e3642b2087 100644
--- a/meta-python/recipes-devtools/python/python3-filelock_3.32.4.bb
+++ b/meta-python/recipes-devtools/python/python3-filelock_3.32.4.bb
@@ -28,6 +28,15 @@  RDEPENDS:${PN} += " \
 RDEPENDS:${PN}-ptest += " \
     python3-pytest-asyncio \
     python3-pytest-mock \
+    python3-pytest-timeout \
     python3-virtualenv \
     python3-discovery \
 "
+
+# tests/ imports itself as "tests.*" and pulls in "capabilities" from the
+# sibling tasks/ dir; pyproject.toml's [tool.pytest] pythonpath=[".", "tasks"]
+# is what upstream relies on to make both resolve.
+do_install_ptest:append() {
+    cp -rf ${S}/tasks ${D}${PTEST_PATH}/
+    cp -f ${S}/pyproject.toml ${D}${PTEST_PATH}/
+}