mirror of
git://git.yoctoproject.org/poky.git
synced 2025-07-19 12:59:02 +02:00

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>
38 lines
1.1 KiB
Plaintext
38 lines
1.1 KiB
Plaintext
#
|
|
# Copyright OpenEmbedded Contributors
|
|
#
|
|
# SPDX-License-Identifier: MIT
|
|
#
|
|
|
|
inherit ptest
|
|
|
|
# Overridable configuration for the directory within the source tree
|
|
# containing the pytest files
|
|
PTEST_PYTEST_DIR ?= "tests"
|
|
|
|
do_install_ptest() {
|
|
# Check if the recipe provides its own version of run-ptest
|
|
# If nothing exists in the SRC_URI, dynamically create a
|
|
# run-test script of "last resort" that has the default
|
|
# pytest behavior.
|
|
#
|
|
# Users can override this behavior by simply including a
|
|
# custom script (run-ptest) in the source file list
|
|
if [ ! -f "${UNPACKDIR}/run-ptest" ]; then
|
|
cat > ${D}${PTEST_PATH}/run-ptest << EOF
|
|
#!/bin/sh
|
|
pytest --automake
|
|
EOF
|
|
# Ensure the newly created script has the execute bit set
|
|
chmod 755 ${D}${PTEST_PATH}/run-ptest
|
|
fi
|
|
if [ -d "${S}/${PTEST_PYTEST_DIR}" ]; then
|
|
install -d ${D}${PTEST_PATH}/${PTEST_PYTEST_DIR}
|
|
cp -rf ${S}/${PTEST_PYTEST_DIR}/* ${D}${PTEST_PATH}/${PTEST_PYTEST_DIR}/
|
|
fi
|
|
}
|
|
|
|
FILES:${PN}-ptest:prepend = "${PTEST_PATH}/*"
|
|
|
|
RDEPENDS:${PN}-ptest:prepend = "python3-pytest python3-unittest-automake-output "
|