diff options
| -rw-r--r-- | meta/classes-recipe/ptest-python-pytest.bbclass | 22 | ||||
| -rwxr-xr-x | meta/files/ptest-python-pytest/run-ptest | 3 |
2 files changed, 14 insertions, 11 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 | ||
| 7 | inherit ptest | 7 | inherit ptest |
| 8 | 8 | ||
| 9 | FILESEXTRAPATHS:prepend := "${COREBASE}/meta/files:" | ||
| 10 | |||
| 11 | SRC_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 |
| 17 | PTEST_PYTEST_DIR ?= "tests" | 11 | PTEST_PYTEST_DIR ?= "tests" |
| 18 | 12 | ||
| 19 | do_install_ptest() { | 13 | do_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 | ||
| 24 | pytest --automake | ||
| 25 | EOF | ||
| 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} |
diff --git a/meta/files/ptest-python-pytest/run-ptest b/meta/files/ptest-python-pytest/run-ptest deleted file mode 100755 index 8d2017d39c..0000000000 --- a/meta/files/ptest-python-pytest/run-ptest +++ /dev/null | |||
| @@ -1,3 +0,0 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | pytest --automake | ||
