summaryrefslogtreecommitdiffstats
path: root/meta/classes-recipe/ptest-python-pytest.bbclass
diff options
context:
space:
mode:
authorDerek Straka <derek@asterius.io>2025-01-10 15:59:29 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2025-01-14 11:57:52 +0000
commit30af2f18b934913148554c82dafb2a2f4b386e38 (patch)
treeeef320b1f987031c996f9eb2eb7cd8fa1918903d /meta/classes-recipe/ptest-python-pytest.bbclass
parente634211f20dd2ff8310bfcdf5885c5ecf323338e (diff)
downloadpoky-30af2f18b934913148554c82dafb2a2f4b386e38.tar.gz
classes/ptest-python-pytest: simplify python ptest file overriding
The complexity of overriding files from the bbclass made the behavior at times hard to follow and predict. This change replaces the default file with a heredoc equivalent that creates a default file if the user does not provide their own version of run-ptest in the SRC_URI. (From OE-Core rev: be3db5f4f1b857b93d08211019d9ff796ec389b6) Signed-off-by: Derek Straka <derek@asterius.io> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes-recipe/ptest-python-pytest.bbclass')
-rw-r--r--meta/classes-recipe/ptest-python-pytest.bbclass22
1 files changed, 14 insertions, 8 deletions
diff --git a/meta/classes-recipe/ptest-python-pytest.bbclass b/meta/classes-recipe/ptest-python-pytest.bbclass
index 6d4f16a96e..a4615e12bf 100644
--- a/meta/classes-recipe/ptest-python-pytest.bbclass
+++ b/meta/classes-recipe/ptest-python-pytest.bbclass
@@ -6,19 +6,25 @@
6 6
7inherit ptest 7inherit ptest
8 8
9FILESEXTRAPATHS:prepend := "${COREBASE}/meta/files:"
10
11SRC_URI:append = "\
12 file://ptest-python-pytest/run-ptest \
13"
14
15# Overridable configuration for the directory within the source tree 9# Overridable configuration for the directory within the source tree
16# containing the pytest files 10# containing the pytest files
17PTEST_PYTEST_DIR ?= "tests" 11PTEST_PYTEST_DIR ?= "tests"
18 12
19do_install_ptest() { 13do_install_ptest() {
20 if [ ! -f ${D}${PTEST_PATH}/run-ptest ]; then 14 # Check if the recipe provides its own version of run-ptest
21 install -m 0755 ${UNPACKDIR}/ptest-python-pytest/run-ptest ${D}${PTEST_PATH} 15 # If nothing exists in the SRC_URI, dynamically create a
16 # run-test script of "last resort" that has the default
17 # pytest behavior.
18 #
19 # Users can override this behavior by simply including a
20 # custom script (run-ptest) in the source file list
21 if [ ! -f "${UNPACKDIR}/run-ptest" ]; then
22 cat > ${D}${PTEST_PATH}/run-ptest << EOF
23#!/bin/sh
24pytest --automake
25EOF
26 # Ensure the newly created script has the execute bit set
27 chmod 755 ${D}${PTEST_PATH}/run-ptest
22 fi 28 fi
23 if [ -d "${S}/${PTEST_PYTEST_DIR}" ]; then 29 if [ -d "${S}/${PTEST_PYTEST_DIR}" ]; then
24 install -d ${D}${PTEST_PATH}/${PTEST_PYTEST_DIR} 30 install -d ${D}${PTEST_PATH}/${PTEST_PYTEST_DIR}