summaryrefslogtreecommitdiffstats
path: root/meta-python
diff options
context:
space:
mode:
authorGyorgy Sarvari <skandigraun@gmail.com>2026-01-09 19:03:21 +0100
committerKhem Raj <raj.khem@gmail.com>2026-01-12 08:53:49 -0800
commit9291faa9192e70ff1f05d6551a562960bdc99630 (patch)
tree128b2c9a110ae9c3add2294b8baa5456a2a42f6e /meta-python
parent0ccf384c90e1e32a548e795250398a31a65a9b5d (diff)
downloadmeta-openembedded-9291faa9192e70ff1f05d6551a562960bdc99630.tar.gz
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 Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com> Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'meta-python')
-rw-r--r--meta-python/conf/include/ptest-packagelists-meta-python.inc1
-rw-r--r--meta-python/recipes-extended/send2trash/python3-send2trash/0001-add-missing-conftest.py.patch52
-rw-r--r--meta-python/recipes-extended/send2trash/python3-send2trash/run-ptest10
-rw-r--r--meta-python/recipes-extended/send2trash/python3-send2trash_2.0.0.bb4
4 files changed, 66 insertions, 1 deletions
diff --git a/meta-python/conf/include/ptest-packagelists-meta-python.inc b/meta-python/conf/include/ptest-packagelists-meta-python.inc
index be548f62b6..8f40bb20a8 100644
--- a/meta-python/conf/include/ptest-packagelists-meta-python.inc
+++ b/meta-python/conf/include/ptest-packagelists-meta-python.inc
@@ -94,6 +94,7 @@ PTESTS_FAST_META_PYTHON = "\
94 python3-rich-toolkit \ 94 python3-rich-toolkit \
95 python3-schedule \ 95 python3-schedule \
96 python3-semver \ 96 python3-semver \
97 python3-send2trash \
97 python3-serpent \ 98 python3-serpent \
98 python3-service-identity \ 99 python3-service-identity \
99 python3-setproctitle \ 100 python3-setproctitle \
diff --git a/meta-python/recipes-extended/send2trash/python3-send2trash/0001-add-missing-conftest.py.patch b/meta-python/recipes-extended/send2trash/python3-send2trash/0001-add-missing-conftest.py.patch
new file mode 100644
index 0000000000..1592fd661c
--- /dev/null
+++ b/meta-python/recipes-extended/send2trash/python3-send2trash/0001-add-missing-conftest.py.patch
@@ -0,0 +1,52 @@
1From ed6d20884108fd7e681baf7278e38ac4800fb5c1 Mon Sep 17 00:00:00 2001
2From: Gyorgy Sarvari <skandigraun@gmail.com>
3Date: Fri, 9 Jan 2026 18:04:08 +0100
4Subject: [PATCH] add missing conftest.py
5
6Conftest.py is missing from the source dictribution of v2.0.0,
7making the tests to fail.
8
9The issue is already solved by upstream, but not tagged yet.
10This patch can be removed with the next release.
11
12Upstream-Status: Inappropriate [workaround until https://github.com/arsenetar/send2trash/commit/f8a40143f696da41f81cae87e1c7f9a345cd4003 is tagged]
13
14Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
15---
16 tests/conftest.py | 27 +++++++++++++++++++++++++++
17 1 file changed, 27 insertions(+)
18 create mode 100644 tests/conftest.py
19
20diff --git a/tests/conftest.py b/tests/conftest.py
21new file mode 100644
22index 0000000..0753384
23--- /dev/null
24+++ b/tests/conftest.py
25@@ -0,0 +1,27 @@
26+# encoding: utf-8
27+import sys
28+import os
29+from tempfile import NamedTemporaryFile
30+import pytest
31+
32+# Only import HOMETRASH on supported platforms
33+if sys.platform != "win32":
34+ from send2trash.plat_other import HOMETRASH
35+
36+
37+@pytest.fixture(name="test_file")
38+def fixture_test_file():
39+ file = NamedTemporaryFile(dir=os.path.expanduser("~"), prefix="send2trash_test", delete=False)
40+ file.close()
41+ # Verify file was actually created
42+ assert os.path.exists(file.name) is True
43+ yield file.name
44+ # Cleanup trash files on supported platforms
45+ if sys.platform != "win32":
46+ name = os.path.basename(file.name)
47+ # Remove trash files if they exist
48+ if os.path.exists(os.path.join(HOMETRASH, "files", name)):
49+ os.remove(os.path.join(HOMETRASH, "files", name))
50+ os.remove(os.path.join(HOMETRASH, "info", name + ".trashinfo"))
51+ if os.path.exists(file.name):
52+ os.remove(file.name)
diff --git a/meta-python/recipes-extended/send2trash/python3-send2trash/run-ptest b/meta-python/recipes-extended/send2trash/python3-send2trash/run-ptest
new file mode 100644
index 0000000000..d8d5e7bd08
--- /dev/null
+++ b/meta-python/recipes-extended/send2trash/python3-send2trash/run-ptest
@@ -0,0 +1,10 @@
1#!/bin/sh
2# Not all tests can run as root
3useradd tester || echo test user already exists
4
5# The test are running in /tmp folder by default, but
6# the tests expect the test folder to be a regular folder, not
7# a mount/symlink. Specify the TMP folder explicitly.
8export TMP=/var/volatile/tmp
9
10su tester -c "pytest --automake"
diff --git a/meta-python/recipes-extended/send2trash/python3-send2trash_2.0.0.bb b/meta-python/recipes-extended/send2trash/python3-send2trash_2.0.0.bb
index 0bd89f887a..48dc8e793f 100644
--- a/meta-python/recipes-extended/send2trash/python3-send2trash_2.0.0.bb
+++ b/meta-python/recipes-extended/send2trash/python3-send2trash_2.0.0.bb
@@ -2,8 +2,10 @@ SUMMARY = "Send file to trash natively under Mac OS X, Windows and Linux"
2LICENSE = "BSD-3-Clause" 2LICENSE = "BSD-3-Clause"
3LIC_FILES_CHKSUM = "file://LICENSE;md5=a02659c2d5f4cc626e4dcf6504b865eb" 3LIC_FILES_CHKSUM = "file://LICENSE;md5=a02659c2d5f4cc626e4dcf6504b865eb"
4 4
5inherit pypi python_setuptools_build_meta 5inherit pypi python_setuptools_build_meta ptest-python-pytest
6 6
7SRC_URI += "file://0001-add-missing-conftest.py.patch \
8 file://run-ptest"
7SRC_URI[sha256sum] = "1761421da3f9930bfe51ed7c45343948573383ad4c27e3acebc91be324e7770d" 9SRC_URI[sha256sum] = "1761421da3f9930bfe51ed7c45343948573383ad4c27e3acebc91be324e7770d"
8 10
9PYPI_PACKAGE = "send2trash" 11PYPI_PACKAGE = "send2trash"