diff mbox series

[meta-python] new recipe: python3-pytest-picked

Message ID 20251125202048.3753948-2-t.f.g.geelen@gmail.com
State Under Review
Headers show
Series [meta-python] new recipe: python3-pytest-picked | expand

Commit Message

Tom Geelen Nov. 25, 2025, 8:20 p.m. UTC
Sorry for the additional email. The previous patch still contained an erroneous line.

Description: Run the tests related to the changed files
Signed-off-by: Tom Geelen <t.f.g.geelen@gmail.com>
---
 .../ptest-packagelists-meta-python.inc        |  1 +
 .../packagegroups/packagegroup-meta-python.bb |  1 +
 ...g-tests-to-capture-only-ptest-output.patch | 50 +++++++++++++++++++
 .../python/python3-pytest-picked/run-ptest    |  5 ++
 .../python/python3-pytest-picked_0.5.1.bb     | 20 ++++++++
 5 files changed, 77 insertions(+)
 create mode 100644 meta-python/recipes-devtools/python/python3-pytest-picked/0001-adjust-failing-tests-to-capture-only-ptest-output.patch
 create mode 100644 meta-python/recipes-devtools/python/python3-pytest-picked/run-ptest
 create mode 100644 meta-python/recipes-devtools/python/python3-pytest-picked_0.5.1.bb

Comments

Khem Raj Nov. 26, 2025, 3:56 a.m. UTC | #1
Thanks for the patch. The commit message could be improved a bit please see
https://docs.yoctoproject.org/dev/contributor-guide/recipe-style-guide.html#examples

On Tue, Nov 25, 2025 at 12:21 PM Tom Geelen via lists.openembedded.org
<t.f.g.geelen=gmail.com@lists.openembedded.org> wrote:

> Sorry for the additional email. The previous patch still contained an
> erroneous line.
>
> Description: Run the tests related to the changed files
> Signed-off-by: Tom Geelen <t.f.g.geelen@gmail.com>
> ---
>  .../ptest-packagelists-meta-python.inc        |  1 +
>  .../packagegroups/packagegroup-meta-python.bb |  1 +
>  ...g-tests-to-capture-only-ptest-output.patch | 50 +++++++++++++++++++
>  .../python/python3-pytest-picked/run-ptest    |  5 ++
>  .../python/python3-pytest-picked_0.5.1.bb     | 20 ++++++++
>  5 files changed, 77 insertions(+)
>  create mode 100644
> meta-python/recipes-devtools/python/python3-pytest-picked/0001-adjust-failing-tests-to-capture-only-ptest-output.patch
>  create mode 100644
> meta-python/recipes-devtools/python/python3-pytest-picked/run-ptest
>  create mode 100644 meta-python/recipes-devtools/python/
> python3-pytest-picked_0.5.1.bb
>
> diff --git a/meta-python/conf/include/ptest-packagelists-meta-python.inc
> b/meta-python/conf/include/ptest-packagelists-meta-python.inc
> index a172f8c676..1cb419a721 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 = "\
>      python3-pyserial \
>      python3-pytest-httpx \
>      python3-pytest-mock \
> +    python3-pytest-picked \
>      python3-pytest-sugar \
>      python3-pytoml \
>      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 = "\
>      python3-pytest-httpx \
>      python3-pytest-lazy-fixtures \
>      python3-pytest-metadata \
> +    python3-pytest-picked\
>      python3-pytest-tempdir \
>      python3-pytest-timeout \
>      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..dfb50ace75
> --- /dev/null
> +++
> b/meta-python/recipes-devtools/python/python3-pytest-picked/0001-adjust-failing-tests-to-capture-only-ptest-output.patch
> @@ -0,0 +1,50 @@
> +From b9341394314e5dcaca0aa1d91fc3af28c64db387 Mon Sep 17 00:00:00 2001
> +From: Tom Geelen <t.f.g.geelen@gmail.com>
> +Date: Tue, 25 Nov 2025 20:42:15 +0100
> +Subject: [PATCH] adjust failing tests to capture only ptest output
> +
> +The tests should only check for warnings emitted by the plugin itself,
> +not for any other warnings that may be emitted by other plugins or pytest
> +itself.
> +
> +Signed-off-by: Tom Geelen <t.f.g.geelen@gmail.com>
> +Upstream-Status: Inappropriate [OE specific]
> +---
> + tests/test_pytest_picked.py | 17 ++++++++++++++---
> + 1 file changed, 14 insertions(+), 3 deletions(-)
> +
> +diff --git a/tests/test_pytest_picked.py b/tests/test_pytest_picked.py
> +index fb2bedb..947b43a 100644
> +--- a/tests/test_pytest_picked.py
> ++++ b/tests/test_pytest_picked.py
> +@@ -182,8 +182,13 @@ def test_should_accept_branch_as_mode(testdir,
> tmpdir, recwarn):
> +                 "Changed test folders... 0. []",
> +             ]
> +         )
> +-        assert len(recwarn) == 1
> +-        assert str(recwarn[0].message) == "Now `main` is the default
> parent branch"
> ++    # Only count the plugin's own UserWarning about default parent branch
> ++    plugin_warnings = [
> ++        w
> ++        for w in recwarn
> ++        if w.category is UserWarning and "default parent branch" in
> str(w.message)
> ++    ]
> ++    assert len(plugin_warnings) == 1
> +
> +
> + def test_should_accept_unstaged_as_mode(testdir, tmpdir, recwarn):
> +@@ -211,7 +216,13 @@ def test_should_accept_unstaged_as_mode(testdir,
> tmpdir, recwarn):
> +                 "Changed test folders... 0. []",
> +             ]
> +         )
> +-        assert len(recwarn) == 0
> ++    # Ignore unrelated deprecation warnings from other plugins
> ++    plugin_warnings = [
> ++        w
> ++        for w in recwarn
> ++        if w.category is UserWarning and "default parent branch" in
> str(w.message)
> ++    ]
> ++    assert len(plugin_warnings) == 0
> +
> +
> + 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 @@
> +#!/bin/sh
> +
> +# need to explicitly call the correct fixture as of pytest 8.x
> +
> +pytest -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 @@
> +SUMMARY = "Run the tests related to the changed files"
> +HOMEPAGE = "https://github.com/anapaulagomes/pytest-picked"
> +LICENSE = "MIT"
> +LIC_FILES_CHKSUM = "file://LICENSE;md5=6d374a27c85c3fcc979009952ec16f1b"
> +RECIPE_MAINTAINER = "Tom Geelen <t.f.g.geelen@gmail.com>"
> +
> +SRC_URI += "file://run-ptest \
> +
>  file://0001-adjust-failing-tests-to-capture-only-ptest-output.patch \
> +           "
> +SRC_URI[sha256sum] =
> "6634c4356a560a5dc3dba35471865e6eb06bbd356b56b69c540593e9d5620ded"
> +
> +inherit pypi python_setuptools_build_meta ptest-python-pytest
> +
> +RDEPENDS:${PN} += "\
> +    git \
> +    python3-pytest (>=3.7.0) \
> +"
> +
> +PYPI_PACKAGE = "pytest_picked"
> +UPSTREAM_CHECK_PYPI_PACKAGE = "${PYPI_PACKAGE}"
> --
> 2.43.0
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#122062):
> https://lists.openembedded.org/g/openembedded-devel/message/122062
> Mute This Topic: https://lists.openembedded.org/mt/116475022/1997914
> Group Owner: openembedded-devel+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [
> raj.khem@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>
diff mbox series

Patch

diff --git a/meta-python/conf/include/ptest-packagelists-meta-python.inc b/meta-python/conf/include/ptest-packagelists-meta-python.inc
index a172f8c676..1cb419a721 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 = "\
     python3-pyserial \
     python3-pytest-httpx \
     python3-pytest-mock \
+    python3-pytest-picked \
     python3-pytest-sugar \
     python3-pytoml \
     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 = "\
     python3-pytest-httpx \
     python3-pytest-lazy-fixtures \
     python3-pytest-metadata \
+    python3-pytest-picked\
     python3-pytest-tempdir \
     python3-pytest-timeout \
     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..dfb50ace75
--- /dev/null
+++ b/meta-python/recipes-devtools/python/python3-pytest-picked/0001-adjust-failing-tests-to-capture-only-ptest-output.patch
@@ -0,0 +1,50 @@ 
+From b9341394314e5dcaca0aa1d91fc3af28c64db387 Mon Sep 17 00:00:00 2001
+From: Tom Geelen <t.f.g.geelen@gmail.com>
+Date: Tue, 25 Nov 2025 20:42:15 +0100
+Subject: [PATCH] adjust failing tests to capture only ptest output
+
+The tests should only check for warnings emitted by the plugin itself,
+not for any other warnings that may be emitted by other plugins or pytest
+itself.
+
+Signed-off-by: Tom Geelen <t.f.g.geelen@gmail.com>
+Upstream-Status: Inappropriate [OE specific]
+---
+ tests/test_pytest_picked.py | 17 ++++++++++++++---
+ 1 file changed, 14 insertions(+), 3 deletions(-)
+
+diff --git a/tests/test_pytest_picked.py b/tests/test_pytest_picked.py
+index fb2bedb..947b43a 100644
+--- a/tests/test_pytest_picked.py
++++ b/tests/test_pytest_picked.py
+@@ -182,8 +182,13 @@ def test_should_accept_branch_as_mode(testdir, tmpdir, recwarn):
+                 "Changed test folders... 0. []",
+             ]
+         )
+-        assert len(recwarn) == 1
+-        assert str(recwarn[0].message) == "Now `main` is the default parent branch"
++    # Only count the plugin's own UserWarning about default parent branch
++    plugin_warnings = [
++        w
++        for w in recwarn
++        if w.category is UserWarning and "default parent branch" in str(w.message)
++    ]
++    assert len(plugin_warnings) == 1
+ 
+ 
+ def test_should_accept_unstaged_as_mode(testdir, tmpdir, recwarn):
+@@ -211,7 +216,13 @@ def test_should_accept_unstaged_as_mode(testdir, tmpdir, recwarn):
+                 "Changed test folders... 0. []",
+             ]
+         )
+-        assert len(recwarn) == 0
++    # Ignore unrelated deprecation warnings from other plugins
++    plugin_warnings = [
++        w
++        for w in recwarn
++        if w.category is UserWarning and "default parent branch" in str(w.message)
++    ]
++    assert len(plugin_warnings) == 0
+ 
+ 
+ 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 @@ 
+#!/bin/sh
+
+# need to explicitly call the correct fixture as of pytest 8.x
+
+pytest -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 @@ 
+SUMMARY = "Run the tests related to the changed files"
+HOMEPAGE = "https://github.com/anapaulagomes/pytest-picked"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=6d374a27c85c3fcc979009952ec16f1b"
+RECIPE_MAINTAINER = "Tom Geelen <t.f.g.geelen@gmail.com>"
+
+SRC_URI += "file://run-ptest \
+           file://0001-adjust-failing-tests-to-capture-only-ptest-output.patch \
+           "
+SRC_URI[sha256sum] = "6634c4356a560a5dc3dba35471865e6eb06bbd356b56b69c540593e9d5620ded"
+
+inherit pypi python_setuptools_build_meta ptest-python-pytest
+
+RDEPENDS:${PN} += "\
+    git \
+    python3-pytest (>=3.7.0) \
+"
+
+PYPI_PACKAGE = "pytest_picked"
+UPSTREAM_CHECK_PYPI_PACKAGE = "${PYPI_PACKAGE}"