Message ID | 20241217223605.3383795-1-derek@asterius.io |
---|---|
State | New |
Headers | show |
Series | [1/2] classes/ptest-python-pytest: add a new class to consolidate ptest functionality for python pytest based tests | expand |
Thank you for your submission. Patchtest identified one or more issues with the patch. Please see the log below for more information: --- Testing patch /home/patchtest/share/mboxes/1-2-classes-ptest-python-pytest-add-a-new-class-to-consolidate-ptest-functionality-for-python-pytest-based-tests.patch FAIL: test shortlog length: Edit shortlog so that it is 90 characters or less (currently 109 characters) (test_mbox.TestMbox.test_shortlog_length) PASS: test Signed-off-by presence (test_mbox.TestMbox.test_signed_off_by_presence) PASS: test author valid (test_mbox.TestMbox.test_author_valid) PASS: test commit message presence (test_mbox.TestMbox.test_commit_message_presence) PASS: test commit message user tags (test_mbox.TestMbox.test_commit_message_user_tags) PASS: test max line length (test_metadata.TestMetadata.test_max_line_length) PASS: test mbox format (test_mbox.TestMbox.test_mbox_format) PASS: test non-AUH upgrade (test_mbox.TestMbox.test_non_auh_upgrade) PASS: test shortlog format (test_mbox.TestMbox.test_shortlog_format) PASS: test target mailing list (test_mbox.TestMbox.test_target_mailing_list) SKIP: pretest pylint: No python related patches, skipping test (test_python_pylint.PyLint.pretest_pylint) SKIP: pretest src uri left files: No modified recipes, skipping pretest (test_metadata.TestMetadata.pretest_src_uri_left_files) SKIP: test CVE check ignore: No modified recipes or older target branch, skipping test (test_metadata.TestMetadata.test_cve_check_ignore) SKIP: test CVE tag format: No new CVE patches introduced (test_patch.TestPatch.test_cve_tag_format) SKIP: test Signed-off-by presence: No new CVE patches introduced (test_patch.TestPatch.test_signed_off_by_presence) SKIP: test Upstream-Status presence: No new CVE patches introduced (test_patch.TestPatch.test_upstream_status_presence_format) SKIP: test bugzilla entry format: No bug ID found (test_mbox.TestMbox.test_bugzilla_entry_format) SKIP: test lic files chksum modified not mentioned: No modified recipes, skipping test (test_metadata.TestMetadata.test_lic_files_chksum_modified_not_mentioned) SKIP: test lic files chksum presence: No added recipes, skipping test (test_metadata.TestMetadata.test_lic_files_chksum_presence) SKIP: test license presence: No added recipes, skipping test (test_metadata.TestMetadata.test_license_presence) SKIP: test pylint: No python related patches, skipping test (test_python_pylint.PyLint.test_pylint) SKIP: test series merge on head: Merge test is disabled for now (test_mbox.TestMbox.test_series_merge_on_head) SKIP: test src uri left files: No modified recipes, skipping pretest (test_metadata.TestMetadata.test_src_uri_left_files) SKIP: test summary presence: No added recipes, skipping test (test_metadata.TestMetadata.test_summary_presence) --- Please address the issues identified and submit a new revision of the patch, or alternatively, reply to this email with an explanation of why the patch should be accepted. If you believe these results are due to an error in patchtest, please submit a bug at https://bugzilla.yoctoproject.org/ (use the 'Patchtest' category under 'Yocto Project Subprojects'). For more information on specific failures, see: https://wiki.yoctoproject.org/wiki/Patchtest. Thank you!
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:" + +SRC_URI += "file://ptest-python-pytest/run-ptest" + +# 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 + 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}/tests/* ${PTEST_PATH}/run-ptest " + +RDEPENDS:${PN}-ptest:prepend = "python3-pytest python3-unittest-automake-output" + +addtask install_ptest_python_pytest after do_install_ptest_base before do_package + +python () { + if not bb.data.inherits_class('native', d) and not bb.data.inherits_class('cross', d): + d.setVarFlag('do_install_ptest_python_pytest', 'fakeroot', '1') + d.setVarFlag('do_install_ptest_python_pytest', 'umask', '022') + + # Remove all '*ptest_python_pytest' tasks when ptest is not enabled + if not(d.getVar('PTEST_ENABLED') == "1"): + for i in ['do_install_ptest_python_pytest']: + bb.build.deltask(i, d) +} diff --git a/meta/files/ptest-python-pytest/run-ptest b/meta/files/ptest-python-pytest/run-ptest new file mode 100755 index 0000000000..8d2017d39c --- /dev/null +++ b/meta/files/ptest-python-pytest/run-ptest @@ -0,0 +1,3 @@ +#!/bin/sh + +pytest --automake
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