summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Geelen <t.f.g.geelen@gmail.com>2025-11-27 00:25:22 +0100
committerKhem Raj <raj.khem@gmail.com>2025-11-26 19:07:04 -0800
commit367faf98ac9fc428592b0a404959457199754c7a (patch)
treed6fa32a07f8feab43f0191612d67e468a9ad77f1
parent5551a12170f347cd9e50d2c57fefa3967a4f80c6 (diff)
downloadmeta-openembedded-367faf98ac9fc428592b0a404959457199754c7a.tar.gz
python3-pytest-picked: Add recipe for version 0.5.1
Python package description: Run the tests related to the unstaged files or the current branch (according to Git) More information: https://pypi.org/project/pytest-picked/ Signed-off-by: Tom Geelen <t.f.g.geelen@gmail.com> Signed-off-by: Khem Raj <raj.khem@gmail.com>
-rw-r--r--meta-python/conf/include/ptest-packagelists-meta-python.inc1
-rw-r--r--meta-python/recipes-core/packagegroups/packagegroup-meta-python.bb1
-rw-r--r--meta-python/recipes-devtools/python/python3-pytest-picked/0001-adjust-failing-tests-to-capture-only-ptest-output.patch51
-rw-r--r--meta-python/recipes-devtools/python/python3-pytest-picked/run-ptest5
-rw-r--r--meta-python/recipes-devtools/python/python3-pytest-picked_0.5.1.bb20
5 files changed, 78 insertions, 0 deletions
diff --git a/meta-python/conf/include/ptest-packagelists-meta-python.inc b/meta-python/conf/include/ptest-packagelists-meta-python.inc
index 7e8ab54639..b0130387bb 100644
--- a/meta-python/conf/include/ptest-packagelists-meta-python.inc
+++ b/meta-python/conf/include/ptest-packagelists-meta-python.inc
@@ -76,6 +76,7 @@ PTESTS_FAST_META_PYTHON = "\
76 python3-pyserial \ 76 python3-pyserial \
77 python3-pytest-httpx \ 77 python3-pytest-httpx \
78 python3-pytest-mock \ 78 python3-pytest-mock \
79 python3-pytest-picked \
79 python3-pytest-sugar \ 80 python3-pytest-sugar \
80 python3-pytoml \ 81 python3-pytoml \
81 python3-pyyaml-include \ 82 python3-pyyaml-include \
diff --git a/meta-python/recipes-core/packagegroups/packagegroup-meta-python.bb b/meta-python/recipes-core/packagegroups/packagegroup-meta-python.bb
index ad68d74205..d3abc0761f 100644
--- a/meta-python/recipes-core/packagegroups/packagegroup-meta-python.bb
+++ b/meta-python/recipes-core/packagegroups/packagegroup-meta-python.bb
@@ -351,6 +351,7 @@ RDEPENDS:packagegroup-meta-python3 = "\
351 python3-pytest-httpx \ 351 python3-pytest-httpx \
352 python3-pytest-lazy-fixtures \ 352 python3-pytest-lazy-fixtures \
353 python3-pytest-metadata \ 353 python3-pytest-metadata \
354 python3-pytest-picked\
354 python3-pytest-tempdir \ 355 python3-pytest-tempdir \
355 python3-pytest-timeout \ 356 python3-pytest-timeout \
356 python3-pytest-xdist \ 357 python3-pytest-xdist \
diff --git a/meta-python/recipes-devtools/python/python3-pytest-picked/0001-adjust-failing-tests-to-capture-only-ptest-output.patch b/meta-python/recipes-devtools/python/python3-pytest-picked/0001-adjust-failing-tests-to-capture-only-ptest-output.patch
new file mode 100644
index 0000000000..b4d7794e47
--- /dev/null
+++ b/meta-python/recipes-devtools/python/python3-pytest-picked/0001-adjust-failing-tests-to-capture-only-ptest-output.patch
@@ -0,0 +1,51 @@
1From b9341394314e5dcaca0aa1d91fc3af28c64db387 Mon Sep 17 00:00:00 2001
2From: Tom Geelen <t.f.g.geelen@gmail.com>
3Date: Tue, 25 Nov 2025 20:42:15 +0100
4Subject: [PATCH] adjust failing tests to capture only ptest output
5
6The tests should only check for warnings emitted by the plugin itself,
7not for any other warnings that may be emitted by other plugins or pytest
8itself. This behavior is caused by the fact that pytest might throw some deprecation warnings
9or other warnings that are unrelated to the plugin being tested.
10
11Signed-off-by: Tom Geelen <t.f.g.geelen@gmail.com>
12Upstream-Status: Inappropriate [OE specific]
13---
14 tests/test_pytest_picked.py | 17 ++++++++++++++---
15 1 file changed, 14 insertions(+), 3 deletions(-)
16
17diff --git a/tests/test_pytest_picked.py b/tests/test_pytest_picked.py
18index fb2bedb..947b43a 100644
19--- a/tests/test_pytest_picked.py
20+++ b/tests/test_pytest_picked.py
21@@ -182,8 +182,13 @@ def test_should_accept_branch_as_mode(testdir, tmpdir, recwarn):
22 "Changed test folders... 0. []",
23 ]
24 )
25- assert len(recwarn) == 1
26- assert str(recwarn[0].message) == "Now `main` is the default parent branch"
27+ # Only count the plugin's own UserWarning about default parent branch
28+ plugin_warnings = [
29+ w
30+ for w in recwarn
31+ if w.category is UserWarning and "default parent branch" in str(w.message)
32+ ]
33+ assert len(plugin_warnings) == 1
34
35
36 def test_should_accept_unstaged_as_mode(testdir, tmpdir, recwarn):
37@@ -211,7 +216,13 @@ def test_should_accept_unstaged_as_mode(testdir, tmpdir, recwarn):
38 "Changed test folders... 0. []",
39 ]
40 )
41- assert len(recwarn) == 0
42+ # Ignore unrelated deprecation warnings from other plugins
43+ plugin_warnings = [
44+ w
45+ for w in recwarn
46+ if w.category is UserWarning and "default parent branch" in str(w.message)
47+ ]
48+ assert len(plugin_warnings) == 0
49
50
51 def test_should_not_run_the_tests_if_mode_is_invalid(testdir, tmpdir):
diff --git a/meta-python/recipes-devtools/python/python3-pytest-picked/run-ptest b/meta-python/recipes-devtools/python/python3-pytest-picked/run-ptest
new file mode 100644
index 0000000000..39f369f20b
--- /dev/null
+++ b/meta-python/recipes-devtools/python/python3-pytest-picked/run-ptest
@@ -0,0 +1,5 @@
1#!/bin/sh
2
3# need to explicitly call the correct fixture as of pytest 8.x
4
5pytest -p pytester --automake
diff --git a/meta-python/recipes-devtools/python/python3-pytest-picked_0.5.1.bb b/meta-python/recipes-devtools/python/python3-pytest-picked_0.5.1.bb
new file mode 100644
index 0000000000..c7c2183337
--- /dev/null
+++ b/meta-python/recipes-devtools/python/python3-pytest-picked_0.5.1.bb
@@ -0,0 +1,20 @@
1SUMMARY = "Run the tests related to the changed files"
2HOMEPAGE = "https://github.com/anapaulagomes/pytest-picked"
3LICENSE = "MIT"
4LIC_FILES_CHKSUM = "file://LICENSE;md5=6d374a27c85c3fcc979009952ec16f1b"
5RECIPE_MAINTAINER = "Tom Geelen <t.f.g.geelen@gmail.com>"
6
7SRC_URI += "file://run-ptest \
8 file://0001-adjust-failing-tests-to-capture-only-ptest-output.patch \
9 "
10SRC_URI[sha256sum] = "6634c4356a560a5dc3dba35471865e6eb06bbd356b56b69c540593e9d5620ded"
11
12inherit pypi python_setuptools_build_meta ptest-python-pytest
13
14RDEPENDS:${PN} += "\
15 git \
16 python3-pytest (>=3.7.0) \
17"
18
19PYPI_PACKAGE = "pytest_picked"
20UPSTREAM_CHECK_PYPI_PACKAGE = "${PYPI_PACKAGE}"