Skip to contentSkip to conversation

python3-pytest-cov: Add initial recipe 4.1.0

PATCH New Jasper Orschulko 1 participant 3 messages Jun 26, 2023

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/3 python3-pytest-cov: Add initial recipe 4.1.0

Dependency for python3-platformdirs 3.6.0 ptest

---
 .../python/python3-pytest-cov_4.1.0.bb             | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
 create mode 100644 meta-python/recipes-devtools/python/python3-pytest-cov_4.1.0.bb
meta-python/recipes-devtools/python/python3-pytest-cov_4.1.0.bb new file +14 -0
new file mode 100644
index 0000000000..1ff3e75cbe
@@ -0,0 +1,14 @@
+SUMMARY = "Pytest plugin for measuring coverage."
+HOMEPAGE = "https://github.com/pytest-dev/pytest-cov"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = " \
+    file://LICENSE;md5=cbc4e25353c748c817db2daffe605e43 \
+"
+
+SRC_URI[sha256sum] = "3904b13dfbfec47f003b8e77fd5b589cd11904a21ddf1ab38a64f204d6a10ef6"
+
+inherit pypi setuptools3
+
+DEPENDS += "${PYTHON_PN}-setuptools-scm-native"
+
+BBCLASSEXTEND = "native nativesdk"
Signature · 1 line
2.41.0
#1 lore raw

PATCH v2 2/3 python3-covdefaults: Add initial recipe 2.3.0

Dependency for python3-platformdirs 3.6.0 ptest

---
 .../python/python3-covdefaults/run-ptest      |  3 ++
 .../python/python3-covdefaults_2.3.0.bb       | 31 +++++++++++++++++++
 2 files changed, 34 insertions(+)
 create mode 100644 meta-python/recipes-devtools/python/python3-covdefaults/run-ptest
 create mode 100644 meta-python/recipes-devtools/python/python3-covdefaults_2.3.0.bb
meta-python/recipes-devtools/python/python3-covdefaults/run-ptest new file +3 -0
new file mode 100644
index 0000000000..3385d68939
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+pytest -o log_cli=true -o log_cli_level=INFO | sed -e 's/\[...%\]//g'| sed -e 's/PASSED/PASS/g'| sed -e 's/FAILED/FAIL/g'|sed -e 's/SKIPED/SKIP/g'| awk '{if ($NF=="PASS" || $NF=="FAIL" || $NF=="SKIP" || $NF=="XFAIL" || $NF=="XPASS"){printf "%s: %s\n", $NF, $0}else{print}}'| awk '{if ($NF=="PASS" || $NF=="FAIL" || $NF=="SKIP" || $NF=="XFAIL" || $NF=="XPASS") {$NF="";print $0}else{print}}'
meta-python/recipes-devtools/python/python3-covdefaults_2.3.0.bb new file +31 -0
new file mode 100644
index 0000000000..b7709aa1ca
@@ -0,0 +1,31 @@
+SUMMARY = "A coverage plugin to provide sensible default settings"
+HOMEPAGE = "https://github.com/asottile/covdefaults"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=a3da826da635201a80d2fb40f3034929"
+
+# Use GitHub SRC_URI, as pypi package does not include tests
+SRC_URI += " \
+    git://github.com/asottile/covdefaults.git;branch=main;protocol=https \
+    file://run-ptest \
+"
+
+SRCREV = "007f5aff5d1c817883385a5f61f742dd11776dc6"
+
+S = "${WORKDIR}/git"
+
+inherit setuptools3 ptest
+
+RDEPENDS:${PN} += " \
+    ${PYTHON_PN}-coverage \
+"
+
+RDEPENDS:${PN}-ptest += " \
+    ${PYTHON_PN}-pytest \
+"
+
+do_install_ptest() {
+        install -d ${D}${PTEST_PATH}
+        cp -rf ${S}/tests ${D}${PTEST_PATH}
+}
+
+BBCLASSEXTEND = "native nativesdk"
Signature · 1 line
2.41.0
#2 lore raw

PATCH v2 3/3 python3-platformdirs: Fix recipe version 3.6.0

In reply to Jasper Orschulko

python3-platformdirs version 3.6.0 requires hatchling build system. Before this fix it would previously build without issue but throw error when used in the final image.

Additionally, fixing the ptest which now requires two additional dependencies.

---
 .../python/python3-platformdirs_3.6.0.bb       | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)
meta-python/recipes-devtools/python/python3-platformdirs_3.6.0.bb +7 -11
index 20b3299ac7..6444fde7ea 100644
@@ -3,32 +3,28 @@ HOMEPAGE = "https://github.com/platformdirs/platformdirs"
 LICENSE = "BSD-3-Clause"
 LIC_FILES_CHKSUM = "file://LICENSE;md5=ea4f5a41454746a9ed111e3d8723d17a"
 
-SRC_URI = " \
-    git://github.com/platformdirs/platformdirs.git;branch=main;protocol=https \
+SRC_URI += " \
     file://run-ptest \
 "
 
-SRCREV ?= "85b0b67eb33a835b797c1d52dab4a06c5554b7ee"
-SRC_URI[sha256sum] = "7954a68d0ba23558d753f73437c55f89027cf8f5108c19844d4b82e5af396335"
+SRC_URI[sha256sum] = "57e28820ca8094678b807ff529196506d7a21e17156cb1cddb3e74cebce54640"
 
-inherit python_setuptools_build_meta ptest
+inherit pypi python_hatchling ptest
 
 DEPENDS += " \
-    python3-hatch-vcs-native \
-    python3-setuptools-scm-native \
-    python3-toml-native \
+    ${PYTHON_PN}-hatch-vcs-native \
 "
 
-S = "${WORKDIR}/git"
-
 RDEPENDS:${PN}-ptest += " \
     ${PYTHON_PN}-appdirs \
+    ${PYTHON_PN}-covdefaults \
     ${PYTHON_PN}-pytest \
     ${PYTHON_PN}-pytest-mock \
+    ${PYTHON_PN}-pytest-cov \
 "
 
 do_install_ptest() {
-        install -d ${D}${PTEST_PATH}/Tests
+        install -d ${D}${PTEST_PATH}
         cp -rf ${S}/tests ${D}${PTEST_PATH}/
 }
 
Signature · 1 line
2.41.0