diff mbox series

[master,v2] python3-inotify: add ptest

Message ID 20221125195601.3696953-1-zheng.qiu@windriver.com
State Under Review
Headers show
Series [master,v2] python3-inotify: add ptest | expand

Commit Message

Zheng Qiu Nov. 25, 2022, 7:56 p.m. UTC
Add ptest provided from the source code, and run it using pytest.

Since the tarball provided with pypi does not include ptest, switch the
source to be its git repo.

ptest result:
           PASS FAIL SKIP
qemux86-64 5    3    1
qemuarm64  5    3    1

This issue exists since inotify adds unit test support, and it is
reported here: https://github.com/dsoprea/PyInotify/issues/95

Signed-off-by: Zheng Qiu <zheng.qiu@windriver.com>
---
 .../python/python3-inotify/run-ptest          |  3 ++
 .../python/python3-inotify_0.2.10.bb          | 14 --------
 .../python/python3-inotify_git.bb             | 35 +++++++++++++++++++
 3 files changed, 38 insertions(+), 14 deletions(-)
 create mode 100644 meta-python/recipes-devtools/python/python3-inotify/run-ptest
 delete mode 100644 meta-python/recipes-devtools/python/python3-inotify_0.2.10.bb
 create mode 100644 meta-python/recipes-devtools/python/python3-inotify_git.bb

Comments

Randy MacLeod Nov. 25, 2022, 10:37 p.m. UTC | #1
On 2022-11-25 14:56, Zheng Qiu wrote:
> Add ptest provided from the source code, and run it using pytest.
> 
> Since the tarball provided with pypi does not include ptest, switch the
> source to be its git repo.
> 
> ptest result:
>             PASS FAIL SKIP
> qemux86-64 5    3    1
> qemuarm64  5    3    1
> 
> This issue exists since inotify adds unit test support, and it is
> reported here: https://github.com/dsoprea/PyInotify/issues/95

As you mentioned elsewhere:

   The two of the test are trying to make notifification using the package
   when a new directory has been created or a directory has been renamed.
   The issue occurs because the result in a list (i.e. ['IN_ISDIR', 
'IN_CREATE'])
   is in different order but contains same components.

   The other test that is always failing is a test that makes a 
directory and
   trying to access those directories. The test is failing because a
   bunch of “width” variable is not as expected.


so while the tests should be fixed, they don't seem to problems with
the underlying functionality. We'll send fixes to upstream should they
ever come out of open source hibernation.

I still think we should use the git/HEAD as I'm suggested in other email.


../Randy

> 
> Signed-off-by: Zheng Qiu <zheng.qiu@windriver.com>
> ---
>   .../python/python3-inotify/run-ptest          |  3 ++
>   .../python/python3-inotify_0.2.10.bb          | 14 --------
>   .../python/python3-inotify_git.bb             | 35 +++++++++++++++++++
>   3 files changed, 38 insertions(+), 14 deletions(-)
>   create mode 100644 meta-python/recipes-devtools/python/python3-inotify/run-ptest
>   delete mode 100644 meta-python/recipes-devtools/python/python3-inotify_0.2.10.bb
>   create mode 100644 meta-python/recipes-devtools/python/python3-inotify_git.bb
> 
> diff --git a/meta-python/recipes-devtools/python/python3-inotify/run-ptest b/meta-python/recipes-devtools/python/python3-inotify/run-ptest
> new file mode 100644
> index 000000000..3385d6893
> --- /dev/null
> +++ b/meta-python/recipes-devtools/python/python3-inotify/run-ptest
> @@ -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}}'
> diff --git a/meta-python/recipes-devtools/python/python3-inotify_0.2.10.bb b/meta-python/recipes-devtools/python/python3-inotify_0.2.10.bb
> deleted file mode 100644
> index 524c3a0d2..000000000
> --- a/meta-python/recipes-devtools/python/python3-inotify_0.2.10.bb
> +++ /dev/null
> @@ -1,14 +0,0 @@
> -SUMMARY = "An adapter to Linux kernel support for inotify directory-watching."
> -AUTHOR = "Dustin Oprea"
> -HOMEPAGE = "https://pypi.org/project/inotify/"
> -LICENSE = "GPL-2.0-only"
> -LIC_FILES_CHKSUM = "file://setup.py;md5=79b7ec72aa0d446a552d3cceb5799e41;beginline=28;endline=28"
> -
> -SRC_URI[sha256sum] = "974a623a338482b62e16d4eb705fb863ed33ec178680fc3e96ccdf0df6c02a07"
> -
> -inherit pypi setuptools3
> -
> -RDEPENDS:${PN} += " \
> -    python3-ctypes \
> -    python3-logging \
> -"
> diff --git a/meta-python/recipes-devtools/python/python3-inotify_git.bb b/meta-python/recipes-devtools/python/python3-inotify_git.bb
> new file mode 100644
> index 000000000..22615a97e
> --- /dev/null
> +++ b/meta-python/recipes-devtools/python/python3-inotify_git.bb
> @@ -0,0 +1,35 @@
> +SUMMARY = "An adapter to Linux kernel support for inotify directory-watching."
> +AUTHOR = "Dustin Oprea"
> +HOMEPAGE = "https://pypi.org/project/inotify/"
> +LICENSE = "GPL-2.0-only"
> +LIC_FILES_CHKSUM = "file://setup.py;md5=79b7ec72aa0d446a552d3cceb5799e41;beginline=28;endline=28"
> +
> +SRC_URI[sha256sum] = "974a623a338482b62e16d4eb705fb863ed33ec178680fc3e96ccdf0df6c02a07"
> +
> +SRC_URI = " \
> +    git://github.com/dsoprea/pyinotify.git;branch=master;protocol=https \
> +    file://run-ptest \
> +"
> +
> +SRCREV = "288a2b01fd4a726dc68d960f8351630aee788a13"
> +
> +S = "${WORKDIR}/git"
> +
> +inherit setuptools3 ptest
> +PIP_INSTALL_PACKAGE = "inotify"
> +PIP_INSTALL_DIST_PATH = "${S}/dist"
> +
> +
> +RDEPENDS:${PN} += " \
> +    python3-ctypes \
> +    python3-logging \
> +"
> +
> +RDEPENDS:${PN}-ptest += " \
> +    ${PYTHON_PN}-pytest \
> +"
> +
> +do_install_ptest() {
> +    install -d ${D}${PTEST_PATH}/tests
> +    cp -rf ${S}/tests/* ${D}${PTEST_PATH}/tests/
> +}
Zheng Qiu Nov. 26, 2022, 5:35 a.m. UTC | #2
On Nov 25, 2022, at 5:37 PM, MacLeod, Randy <Randy.MacLeod@windriver.com> wrote:

On 2022-11-25 14:56, Zheng Qiu wrote:
Add ptest provided from the source code, and run it using pytest.
Since the tarball provided with pypi does not include ptest, switch the
source to be its git repo.
ptest result:
           PASS FAIL SKIP
qemux86-64 5    3    1
qemuarm64  5    3    1
This issue exists since inotify adds unit test support, and it is
reported here: https://github.com/dsoprea/PyInotify/issues/95

As you mentioned elsewhere:

 The two of the test are trying to make notifification using the package
 when a new directory has been created or a directory has been renamed.
 The issue occurs because the result in a list (i.e. ['IN_ISDIR', 'IN_CREATE'])
 is in different order but contains same components.

 The other test that is always failing is a test that makes a directory and
 trying to access those directories. The test is failing because a
 bunch of “width” variable is not as expected.

While further investigating it, I start doubting if the tests are failing because of some issue in the base code.



so while the tests should be fixed, they don't seem to problems with
the underlying functionality. We'll send fixes to upstream should they
ever come out of open source hibernation.

Furthermore, if I remember correctly, there are actually more failing tests with later commits.
I will double-check to find the best strategy.


I still think we should use the git/HEAD as I'm suggested in other email.


../Randy

Signed-off-by: Zheng Qiu <zheng.qiu@windriver.com>
---
 .../python/python3-inotify/run-ptest          |  3 ++
 .../python/python3-inotify_0.2.10.bb          | 14 --------
 .../python/python3-inotify_git.bb             | 35 +++++++++++++++++++
 3 files changed, 38 insertions(+), 14 deletions(-)
 create mode 100644 meta-python/recipes-devtools/python/python3-inotify/run-ptest
 delete mode 100644 meta-python/recipes-devtools/python/python3-inotify_0.2.10.bb
 create mode 100644 meta-python/recipes-devtools/python/python3-inotify_git.bb
diff --git a/meta-python/recipes-devtools/python/python3-inotify/run-ptest b/meta-python/recipes-devtools/python/python3-inotify/run-ptest
new file mode 100644
index 000000000..3385d6893
--- /dev/null
+++ b/meta-python/recipes-devtools/python/python3-inotify/run-ptest
@@ -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}}'
diff --git a/meta-python/recipes-devtools/python/python3-inotify_0.2.10.bb b/meta-python/recipes-devtools/python/python3-inotify_0.2.10.bb
deleted file mode 100644
index 524c3a0d2..000000000
--- a/meta-python/recipes-devtools/python/python3-inotify_0.2.10.bb
+++ /dev/null
@@ -1,14 +0,0 @@
-SUMMARY = "An adapter to Linux kernel support for inotify directory-watching."
-AUTHOR = "Dustin Oprea"
-HOMEPAGE = "https://pypi.org/project/inotify/"
-LICENSE = "GPL-2.0-only"
-LIC_FILES_CHKSUM = "file://setup.py;md5=79b7ec72aa0d446a552d3cceb5799e41;beginline=28;endline=28"
-
-SRC_URI[sha256sum] = "974a623a338482b62e16d4eb705fb863ed33ec178680fc3e96ccdf0df6c02a07"
-
-inherit pypi setuptools3
-
-RDEPENDS:${PN} += " \
-    python3-ctypes \
-    python3-logging \
-"
diff --git a/meta-python/recipes-devtools/python/python3-inotify_git.bb b/meta-python/recipes-devtools/python/python3-inotify_git.bb
new file mode 100644
index 000000000..22615a97e
--- /dev/null
+++ b/meta-python/recipes-devtools/python/python3-inotify_git.bb
@@ -0,0 +1,35 @@
+SUMMARY = "An adapter to Linux kernel support for inotify directory-watching."
+AUTHOR = "Dustin Oprea"
+HOMEPAGE = "https://pypi.org/project/inotify/"
+LICENSE = "GPL-2.0-only"
+LIC_FILES_CHKSUM = "file://setup.py;md5=79b7ec72aa0d446a552d3cceb5799e41;beginline=28;endline=28"
+
+SRC_URI[sha256sum] = "974a623a338482b62e16d4eb705fb863ed33ec178680fc3e96ccdf0df6c02a07"
+
+SRC_URI = " \
+    git://github.com/dsoprea/pyinotify.git;branch=master;protocol=https \
+    file://run-ptest \
+"
+
+SRCREV = "288a2b01fd4a726dc68d960f8351630aee788a13"
+
+S = "${WORKDIR}/git"
+
+inherit setuptools3 ptest
+PIP_INSTALL_PACKAGE = "inotify"
+PIP_INSTALL_DIST_PATH = "${S}/dist"
+
+
+RDEPENDS:${PN} += " \
+    python3-ctypes \
+    python3-logging \
+"
+
+RDEPENDS:${PN}-ptest += " \
+    ${PYTHON_PN}-pytest \
+"
+
+do_install_ptest() {
+    install -d ${D}${PTEST_PATH}/tests
+    cp -rf ${S}/tests/* ${D}${PTEST_PATH}/tests/
+}

--
# Randy MacLeod
# Wind River Linux
diff mbox series

Patch

diff --git a/meta-python/recipes-devtools/python/python3-inotify/run-ptest b/meta-python/recipes-devtools/python/python3-inotify/run-ptest
new file mode 100644
index 000000000..3385d6893
--- /dev/null
+++ b/meta-python/recipes-devtools/python/python3-inotify/run-ptest
@@ -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}}'
diff --git a/meta-python/recipes-devtools/python/python3-inotify_0.2.10.bb b/meta-python/recipes-devtools/python/python3-inotify_0.2.10.bb
deleted file mode 100644
index 524c3a0d2..000000000
--- a/meta-python/recipes-devtools/python/python3-inotify_0.2.10.bb
+++ /dev/null
@@ -1,14 +0,0 @@ 
-SUMMARY = "An adapter to Linux kernel support for inotify directory-watching."
-AUTHOR = "Dustin Oprea"
-HOMEPAGE = "https://pypi.org/project/inotify/"
-LICENSE = "GPL-2.0-only"
-LIC_FILES_CHKSUM = "file://setup.py;md5=79b7ec72aa0d446a552d3cceb5799e41;beginline=28;endline=28"
-
-SRC_URI[sha256sum] = "974a623a338482b62e16d4eb705fb863ed33ec178680fc3e96ccdf0df6c02a07"
-
-inherit pypi setuptools3
-
-RDEPENDS:${PN} += " \
-    python3-ctypes \
-    python3-logging \
-"
diff --git a/meta-python/recipes-devtools/python/python3-inotify_git.bb b/meta-python/recipes-devtools/python/python3-inotify_git.bb
new file mode 100644
index 000000000..22615a97e
--- /dev/null
+++ b/meta-python/recipes-devtools/python/python3-inotify_git.bb
@@ -0,0 +1,35 @@ 
+SUMMARY = "An adapter to Linux kernel support for inotify directory-watching."
+AUTHOR = "Dustin Oprea"
+HOMEPAGE = "https://pypi.org/project/inotify/"
+LICENSE = "GPL-2.0-only"
+LIC_FILES_CHKSUM = "file://setup.py;md5=79b7ec72aa0d446a552d3cceb5799e41;beginline=28;endline=28"
+
+SRC_URI[sha256sum] = "974a623a338482b62e16d4eb705fb863ed33ec178680fc3e96ccdf0df6c02a07"
+
+SRC_URI = " \
+    git://github.com/dsoprea/pyinotify.git;branch=master;protocol=https \
+    file://run-ptest \
+"
+
+SRCREV = "288a2b01fd4a726dc68d960f8351630aee788a13"
+
+S = "${WORKDIR}/git"
+
+inherit setuptools3 ptest
+PIP_INSTALL_PACKAGE = "inotify"
+PIP_INSTALL_DIST_PATH = "${S}/dist"
+
+
+RDEPENDS:${PN} += " \
+    python3-ctypes \
+    python3-logging \
+"
+
+RDEPENDS:${PN}-ptest += " \
+    ${PYTHON_PN}-pytest \
+"
+
+do_install_ptest() {
+    install -d ${D}${PTEST_PATH}/tests
+    cp -rf ${S}/tests/* ${D}${PTEST_PATH}/tests/
+}