From: Quentin Schulz <quentin.schulz@cherry.de>
To: derek@asterius.io, openembedded-core@lists.openembedded.org
Subject: Re: [OE-core][PATCHv2 1/2] classes/ptest-python-pytest: add a new class to consolidate pytest ptest functionality
Date: Wed, 18 Dec 2024 14:32:30 +0100 [thread overview]
Message-ID: <3edaa887-9925-4503-9126-22fcb0a6175a@cherry.de> (raw)
In-Reply-To: <20241217231202.3384873-1-derek@asterius.io>
Hi Derek,
On 12/18/24 12:12 AM, Derek Straka via lists.openembedded.org wrote:
> A large number of python packages leverage the pytest unit test
> framework for their ptest functionality. Currently, many of the tests
> have duplicate code for:
> 1. Installing pytest files
> 2. Declaring ptest dependencies
> 3. Script for executing tests (run-ptes)
>
> To simplify adding common pytest based ptests, added a new class
> enabling base functionality. Users can also override the location of
> the pytest files in addition to using their own version of run-ptest
>
> Signed-off-by: Derek Straka <derek@asterius.io>
> ---
> .../ptest-python-pytest.bbclass | 42 +++++++++++++++++++
> meta/files/ptest-python-pytest/run-ptest | 3 ++
> 2 files changed, 45 insertions(+)
> create mode 100644 meta/classes-recipe/ptest-python-pytest.bbclass
> create mode 100755 meta/files/ptest-python-pytest/run-ptest
>
> diff --git a/meta/classes-recipe/ptest-python-pytest.bbclass b/meta/classes-recipe/ptest-python-pytest.bbclass
> new file mode 100644
> index 0000000000..89ff10c335
> --- /dev/null
> +++ b/meta/classes-recipe/ptest-python-pytest.bbclass
> @@ -0,0 +1,42 @@
> +#
> +# Copyright OpenEmbedded Contributors
> +#
> +# SPDX-License-Identifier: MIT
> +#
> +
> +inherit ptest
> +
> +FILESEXTRAPATHS:prepend := "${COREBASE}/meta/files:"
I think it'd make sense to use :append here as we don't want to override
anything, just provide a fallback in case the
ptest-python-pytest/run-ptest isn't find anywhere else. This would also
allow to easily override this file by just adding the file next to the
recipe, instead of having to add a FILESEXTRAPATHS:prepend :=
"${THISDIR}/${PN}:" in the recipe after the inherit for example.
> +
> +SRC_URI += "file://ptest-python-pytest/run-ptest"
> +
We use append/prepend everywhere but here, should we?
> +# Overridable configuration for the directory within the source tree
> +# containing the pytest files
> +PTEST_PYTEST_DIR ?= "/tests"
> +
> +do_install_ptest_python_pytest() {
> + if [ ! -f ${D}${PTEST_PATH}/run-ptest ]; then
> + install -m 0755 ${UNPACKDIR}/ptest-python-pytest/run-ptest ${D}${PTEST_PATH}
> + fi
This means if we ever built the recipe and don't clean its WORKDIR, but
update the file, it will never be updated. I don't think that's what we
want. Can you explain what you're trying to prevent here by having a
check for NOT installing the file?
> + if [ -d "${S}/${PTEST_PYTEST_DIR}" ]; then
Shouldn't we use UNPACKDIR for file:// SRC_URI in master?
Cheers,
Quentin
next prev parent reply other threads:[~2024-12-18 13:32 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-17 23:12 [OE-core][PATCHv2 1/2] classes/ptest-python-pytest: add a new class to consolidate pytest ptest functionality Derek Straka
2024-12-17 23:12 ` [OE-core][PATCHv2 2/2] python3-*: Update recipes with pytest ptests to use the new ptest-python-pytest class Derek Straka
2024-12-18 7:34 ` [OE-core][PATCHv2 1/2] classes/ptest-python-pytest: add a new class to consolidate pytest ptest functionality Alexander Kanavin
2024-12-18 13:32 ` Quentin Schulz [this message]
2024-12-18 18:04 ` Derek Straka
2024-12-19 10:37 ` Quentin Schulz
2024-12-19 17:58 ` Derek Straka
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3edaa887-9925-4503-9126-22fcb0a6175a@cherry.de \
--to=quentin.schulz@cherry.de \
--cc=derek@asterius.io \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox