Skip to contentSkip to conversation

python3-send2trash: add ptest support

PATCH New Gyorgy Sarvari 1 participant 2 messages Jan 9

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 python3-send2trash: add ptest support

The tests take less than a second to execute.

The current source distribution is missing a test file, which I added with a patch. The problem is already solved by upstream just not tagged yet - the patch can be dropped with the next update.

Sample output:

root@qemux86-64:~# ptest-runner
START: ptest-runner
2026-01-09T17:11
BEGIN: /usr/lib/python3-send2trash/ptest
SKIP: tests/test_plat_win.py:tests/test_plat_win.py # SKIP Skipping windows-only tests
PASS: tests/test_plat_other.py:test_trash
PASS: tests/test_plat_other.py:test_multitrash
PASS: tests/test_plat_other.py:test_trash_bytes
PASS: tests/test_plat_other.py:test_trash_unicode
PASS: tests/test_plat_other.py:test_trash_topdir
PASS: tests/test_plat_other.py:test_trash_topdir_fallback
PASS: tests/test_plat_other.py:test_trash_topdir_failure
PASS: tests/test_plat_other.py:test_trash_symlink
PASS: tests/test_script_main.py:test_trash
PASS: tests/test_script_main.py:test_no_args
============================================================================
Testsuite summary
DURATION: 1
END: /usr/lib/python3-send2trash/ptest
2026-01-09T17:11
STOP: ptest-runner
TOTAL: 1 FAIL: 0
---
 .../ptest-packagelists-meta-python.inc        |  1 +
 .../0001-add-missing-conftest.py.patch        | 52 +++++++++++++++++++
 .../send2trash/python3-send2trash/run-ptest   | 10 ++++
 .../send2trash/python3-send2trash_2.0.0.bb    |  4 +-
 4 files changed, 66 insertions(+), 1 deletion(-)
 create mode 100644 meta-python/recipes-extended/send2trash/python3-send2trash/0001-add-missing-conftest.py.patch
 create mode 100644 meta-python/recipes-extended/send2trash/python3-send2trash/run-ptest
meta-python/conf/include/ptest-packagelists-meta-python.inc +1 -0
index cdec25f876..a297441bf6 100644
@@ -94,6 +94,7 @@ PTESTS_FAST_META_PYTHON = "\
     python3-rich-toolkit \
     python3-schedule \
     python3-semver \
+    python3-send2trash \
     python3-serpent \
     python3-service-identity \
     python3-setproctitle \
meta-python/recipes-extended/send2trash/python3-send2trash/0001-add-missing-conftest.py.patch new file +52 -0

52 lines not on this page · raw message

meta-python/recipes-extended/send2trash/python3-send2trash/run-ptest new file +10 -0
new file mode 100644
index 0000000000..d8d5e7bd08
@@ -0,0 +1,10 @@
+#!/bin/sh
+# Not all tests can run as root
+useradd tester || echo test user already exists
+
+# The test are running in /tmp folder by default, but
+# the tests expect the test folder to be a regular folder, not
+# a mount/symlink. Specify the TMP folder explicitly.
+export TMP=/var/volatile/tmp
+
+su tester -c "pytest --automake"
meta-python/recipes-extended/send2trash/python3-send2trash_2.0.0.bb +3 -1
index 0bd89f887a..48dc8e793f 100644
@@ -2,8 +2,10 @@ SUMMARY = "Send file to trash natively under Mac OS X, Windows and Linux"
 LICENSE = "BSD-3-Clause"
 LIC_FILES_CHKSUM = "file://LICENSE;md5=a02659c2d5f4cc626e4dcf6504b865eb"
 
-inherit pypi python_setuptools_build_meta
+inherit pypi python_setuptools_build_meta ptest-python-pytest
 
+SRC_URI += "file://0001-add-missing-conftest.py.patch \
+            file://run-ptest"
 SRC_URI[sha256sum] = "1761421da3f9930bfe51ed7c45343948573383ad4c27e3acebc91be324e7770d"
 
 PYPI_PACKAGE = "send2trash"
#1 lore raw

PATCH 2/2 python3-filelock: add ptest support

The tests take <15s to execute.

Sample output:

root@qemux86-64:~# ptest-runner
START: ptest-runner
2026-01-09T18:00
BEGIN: /usr/lib/python3-filelock/ptest
PASS: tests/test_async_filelock.py:test_simple[a-str-AsyncUnixFileLock]
PASS: tests/test_async_filelock.py:test_simple[a-str-AsyncSoftFileLock]
PASS: tests/test_async_filelock.py:test_simple[a-PurePath-AsyncUnixFileLock]
PASS: tests/test_async_filelock.py:test_simple[a-PurePath-AsyncSoftFileLock]
PASS: tests/test_async_filelock.py:test_simple[a-Path-AsyncUnixFileLock]
PASS: tests/test_async_filelock.py:test_simple[a-Path-AsyncSoftFileLock]
[...many lines...]
PASS: tests/test_filelock.py:test_mtime_zero_exit_branch[SoftFileLock-TimeoutError]
PASS: tests/test_filelock.py:test_mtime_zero_exit_branch[UnixFileLock-PermissionError]
PASS: tests/test_virtualenv.py:test_virtualenv
============================================================================
Testsuite summary
DURATION: 10
END: /usr/lib/python3-filelock/ptest
2026-01-09T18:00
STOP: ptest-runner
TOTAL: 1 FAIL: 0

(There are 20 Windows-only tests, which are skipped)

---
 .../conf/include/ptest-packagelists-meta-python.inc      | 1 +
 .../recipes-devtools/python/python3-filelock/run-ptest   | 6 ++++++
 .../recipes-devtools/python/python3-filelock_3.20.2.bb   | 9 ++++++++-
 3 files changed, 15 insertions(+), 1 deletion(-)
 create mode 100644 meta-python/recipes-devtools/python/python3-filelock/run-ptest
meta-python/conf/include/ptest-packagelists-meta-python.inc +1 -0
index a297441bf6..7261382bdd 100644
@@ -29,6 +29,7 @@ PTESTS_FAST_META_PYTHON = "\
     python3-execnet \
     python3-fastjsonschema \
     python3-fastnumbers \
+    python3-filelock \
     python3-flask \
     python3-flexcache \
     python3-flexparser \
meta-python/recipes-devtools/python/python3-filelock/run-ptest new file +6 -0
new file mode 100644
index 0000000000..88654deb70
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Some tests require non-root
+useradd tester || echo test user exists already
+
+su tester -c "pytest --automake"
meta-python/recipes-devtools/python/python3-filelock_3.20.2.bb +8 -1
index 75eb16635c..2a0af552b6 100644
@@ -5,11 +5,12 @@ HOMEPAGE = "https://py-filelock.readthedocs.io/"
 LICENSE = "Unlicense"
 LIC_FILES_CHKSUM = "file://LICENSE;md5=911690f51af322440237a253d695d19f"
 
+SRC_URI += "file://run-ptest"
 SRC_URI[sha256sum] = "a2241ff4ddde2a7cebddf78e39832509cb045d18ec1a09d7248d6bfc6bfbbe64"
 
 BBCLASSEXTEND = "native nativesdk"
 
-inherit pypi python_hatchling
+inherit pypi python_hatchling ptest-python-pytest
 
 DEPENDS += "\
     python3-hatch-vcs-native \
@@ -20,3 +21,9 @@ RDEPENDS:${PN} += " \
     python3-logging \
     python3-asyncio \
 "
+
+RDEPENDS:${PN}-ptest += " \
+    python3-pytest-asyncio \
+    python3-pytest-mock \
+    python3-virtualenv \
+"