diff mbox series

[master] python3-inotify: add ptest

Message ID 20221125171044.3649193-1-zheng.qiu@windriver.com
State New
Headers show
Series [master] python3-inotify: add ptest | expand

Commit Message

Zheng Qiu Nov. 25, 2022, 5:10 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.

Signed-off-by: Zheng Qiu <zheng.qiu@windriver.com>
---
 .../python/python3-inotify/run-ptest          |  3 +++
 .../python/python3-inotify_0.2.10.bb          | 23 ++++++++++++++++++-
 2 files changed, 25 insertions(+), 1 deletion(-)
 create mode 100644 meta-python/recipes-devtools/python/python3-inotify/run-ptest

Comments

Randy MacLeod Nov. 25, 2022, 7:02 p.m. UTC | #1
On 2022-11-25 12:10, Zheng Qiu wrote:
> Add ptest provided from the source code, and run it using pytest.
Super, can you add the ptest result summary in this log.
If any of the tests are failing also add upstream issue links.
>
> Since the tarball provided with pypi does not include ptest, switch the
s/does not include ptest/does not include the test code/
> source to be its git repo.
>
> Signed-off-by: Zheng Qiu <zheng.qiu@windriver.com>
> ---
>   .../python/python3-inotify/run-ptest          |  3 +++
>   .../python/python3-inotify_0.2.10.bb          | 23 ++++++++++++++++++-
This should be renamed from python3-inotify_0.2.10.bb to
something like python3-inotify_git.bb
>   2 files changed, 25 insertions(+), 1 deletion(-)
>   create mode 100644 meta-python/recipes-devtools/python/python3-inotify/run-ptest
>
> 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
> index 524c3a0d2..3306438a1 100644
> --- a/meta-python/recipes-devtools/python/python3-inotify_0.2.10.bb
> +++ b/meta-python/recipes-devtools/python/python3-inotify_0.2.10.bb
> @@ -6,9 +6,30 @@ LIC_FILES_CHKSUM = "file://setup.py;md5=79b7ec72aa0d446a552d3cceb5799e41;beginli
>   
>   SRC_URI[sha256sum] = "974a623a338482b62e16d4eb705fb863ed33ec178680fc3e96ccdf0df6c02a07"
>   
> -inherit pypi setuptools3
> +SRC_URI = " \
> +    git://github.com/dsoprea/pyinotify.git;branch=master;protocol=https \
> +    file://run-ptest \
> +"
> +
> +SRCREV = "f77596ae965e47124f38d7bd6587365924dcd8f7"
This is the current head, which is fine but add a note in the  long log
about that choice. It's
$ git log --oneline 0.2.10... | wc -l

14

commits ahead of 0.2.10


> +
> +S = "${WORKDIR}/git"
> +
> +inherit setuptools3 ptest
> +PIP_INSTALL_PACKAGE = "inotify"
> +PIP_INSTALL_DIST_PATH = "${S}/dist"
Mostly harmless, I suppose. Any pippy pythonistas want to comment/explain?
> +
>   
>   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/
> +}

v2 please.
Zheng Qiu Nov. 25, 2022, 7:55 p.m. UTC | #2
On Nov 25, 2022, at 2:02 PM, MacLeod, Randy <Randy.MacLeod@windriver.com> wrote:

On 2022-11-25 12:10, Zheng Qiu wrote:
Add ptest provided from the source code, and run it using pytest.
Super, can you add the ptest result summary in this log.
If any of the tests are failing also add upstream issue links.

Sure.


Since the tarball provided with pypi does not include ptest, switch the
s/does not include ptest/does not include the test code/

Okay.


source to be its git repo.

Signed-off-by: Zheng Qiu <zheng.qiu@windriver.com<mailto:zheng.qiu@windriver.com>>
---
 .../python/python3-inotify/run-ptest          |  3 +++
 .../python/python3-inotify_0.2.10.bb          | 23 ++++++++++++++++++-
This should be renamed from python3-inotify_0.2.10.bb to
something like python3-inotify_git.bb

OK.

 2 files changed, 25 insertions(+), 1 deletion(-)
 create mode 100644 meta-python/recipes-devtools/python/python3-inotify/run-ptest

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
index 524c3a0d2..3306438a1 100644
--- a/meta-python/recipes-devtools/python/python3-inotify_0.2.10.bb
+++ b/meta-python/recipes-devtools/python/python3-inotify_0.2.10.bb
@@ -6,9 +6,30 @@ LIC_FILES_CHKSUM = "file://setup.py;md5=79b7ec72aa0d446a552d3cceb5799e41;beginli
   SRC_URI[sha256sum] = "974a623a338482b62e16d4eb705fb863ed33ec178680fc3e96ccdf0df6c02a07"
 -inherit pypi setuptools3
+SRC_URI = " \
+    git://github.com/dsoprea/pyinotify.git;branch=master;protocol=https \
+    file://run-ptest \
+"
+
+SRCREV = "f77596ae965e47124f38d7bd6587365924dcd8f7"
This is the current head, which is fine but add a note in the  long log
about that choice. It's
$ git log --oneline 0.2.10... | wc -l

14

commits ahead of 0.2.10


Will change it to the head of 0.2.10


+
+S = "${WORKDIR}/git"
+
+inherit setuptools3 ptest
+PIP_INSTALL_PACKAGE = "inotify"
+PIP_INSTALL_DIST_PATH = "${S}/dist"
Mostly harmless, I suppose. Any pippy pythonistas want to comment/explain?

Since this recipe does not inherit pypi anymore, setting this would help wheel build.

+
   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/
+}

v2 please.

--
# Randy MacLeod
# Wind River Linux
Randy MacLeod Nov. 25, 2022, 9:43 p.m. UTC | #3
On 2022-11-25 14:55, Qiu, Zheng wrote:
>>>
>>> +
>>> +SRCREV = "f77596ae965e47124f38d7bd6587365924dcd8f7"
>> This is the current head, which is fine but add a note in the  long log
>> about that choice. It's
>> $ git log --oneline 0.2.10... | wc -l
>>
>> 14
>>
>> commits ahead of 0.2.10
>>
> 
> Will change it to the head of 0.2.10

Hmmm, here are the commits, most of which don't affect runtime:

$ git log --oneline 0.2.10...
f77596a (HEAD -> master, origin/master, origin/HEAD) Add Dockerfile
9be6a51 Fix constant in adapter to match with DELETE events
    ^^^^^-------- seems like a bug fix that we should pick up. <<----
269d541 etup.cfg: Add missing newline
8e79335 tests/test_inotify.py: Canonicalize import
f844ea2 Added setup.cfg option to make bdist_wheel create
         a universal wheel.
53fd4ea Increase test coverage of Inotify initializer (#76)
0d802dc Update README.rst
f0d5b98 Update README.rst
9075acc Fix for issue #66, removing 'nose' as a production requirement.
82d1439 .travis.yml: Use 4.x version of coverage package
ebffda0 .travis.yml: Drop 3.3 support. Add 3.6, 3.7, 3.8
983049a .gitignore: Add ignore
cd7b276 requirements.txt: Remove nose from requirements
7202fc4 Propagate superficial parameter to remove_watch_with_id


Here's that one, reformatted, patch:

commit 9be6a51d1660991562eefaaddefa757ca0e0e00f
Author: Raphaël Beamonte <raphael.beamonte@gmail.com>
Date:   Sun Jul 29 01:24:52 2018

     Fix constant in adapter to match with DELETE events

     The previous behavior was duplicating a block of code and making
     one of the two useless. This fixes that by replacing the constant to
     IN_DELETE instead of IN_MOVED_FROM in one of the two blocks.

     Signed-off-by: Raphaël Beamonte <raphael.beamonte@gmail.com>

diff --git a/inotify/adapters.py b/inotify/adapters.py
index 7f3f708..e8301da 100644
--- a/inotify/adapters.py
+++ b/inotify/adapters.py
@@ -299,7 +299,7 @@ class _BaseTree(object):

                   self._i.add_watch(full_path, self._mask)

-             if header.mask & inotify.constants.IN_MOVED_FROM:
+             if header.mask & inotify.constants.IN_DELETE:
                   _LOGGER.debug("A directory has been removed. We're "
                                 "being recursive, but it would have "
                                 "automatically been deregistered: [%s]",



What's the impact to users of not having this fix?
It seems like a bug fix that we should pick up by backport of
user _git and HEAD.
Zheng Qiu Nov. 25, 2022, 10:28 p.m. UTC | #4
On Nov 25, 2022, at 4:43 PM, MacLeod, Randy <Randy.MacLeod@windriver.com> wrote:

On 2022-11-25 14:55, Qiu, Zheng wrote:

+
+SRCREV = "f77596ae965e47124f38d7bd6587365924dcd8f7"
This is the current head, which is fine but add a note in the  long log
about that choice. It's
$ git log --oneline 0.2.10... | wc -l

14

commits ahead of 0.2.10

Will change it to the head of 0.2.10

Hmmm, here are the commits, most of which don't affect runtime:

$ git log --oneline 0.2.10...
f77596a (HEAD -> master, origin/master, origin/HEAD) Add Dockerfile
9be6a51 Fix constant in adapter to match with DELETE events
  ^^^^^-------- seems like a bug fix that we should pick up. <<----
269d541 etup.cfg: Add missing newline
8e79335 tests/test_inotify.py: Canonicalize import
f844ea2 Added setup.cfg option to make bdist_wheel create
       a universal wheel.
53fd4ea Increase test coverage of Inotify initializer (#76)
0d802dc Update README.rst
f0d5b98 Update README.rst
9075acc Fix for issue #66, removing 'nose' as a production requirement.
82d1439 .travis.yml: Use 4.x version of coverage package
ebffda0 .travis.yml: Drop 3.3 support. Add 3.6, 3.7, 3.8
983049a .gitignore: Add ignore
cd7b276 requirements.txt: Remove nose from requirements
7202fc4 Propagate superficial parameter to remove_watch_with_id


Here's that one, reformatted, patch:

commit 9be6a51d1660991562eefaaddefa757ca0e0e00f
Author: Raphaël Beamonte <raphael.beamonte@gmail.com>
Date:   Sun Jul 29 01:24:52 2018

   Fix constant in adapter to match with DELETE events

   The previous behavior was duplicating a block of code and making
   one of the two useless. This fixes that by replacing the constant to
   IN_DELETE instead of IN_MOVED_FROM in one of the two blocks.

   Signed-off-by: Raphaël Beamonte <raphael.beamonte@gmail.com>

diff --git a/inotify/adapters.py b/inotify/adapters.py
index 7f3f708..e8301da 100644
--- a/inotify/adapters.py
+++ b/inotify/adapters.py
@@ -299,7 +299,7 @@ class _BaseTree(object):

                 self._i.add_watch(full_path, self._mask)

-             if header.mask & inotify.constants.IN_MOVED_FROM:
+             if header.mask & inotify.constants.IN_DELETE:
                 _LOGGER.debug("A directory has been removed. We're "
                               "being recursive, but it would have "
                               "automatically been deregistered: [%s]",



What's the impact to users of not having this fix?
It seems like a bug fix that we should pick up by backport of
user _git and HEAD.

I will submit another patch for this…because I am worried about if some commit in between will produce further bugs.
This package seems like have very limited support right now.



--
# 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
index 524c3a0d2..3306438a1 100644
--- a/meta-python/recipes-devtools/python/python3-inotify_0.2.10.bb
+++ b/meta-python/recipes-devtools/python/python3-inotify_0.2.10.bb
@@ -6,9 +6,30 @@  LIC_FILES_CHKSUM = "file://setup.py;md5=79b7ec72aa0d446a552d3cceb5799e41;beginli
 
 SRC_URI[sha256sum] = "974a623a338482b62e16d4eb705fb863ed33ec178680fc3e96ccdf0df6c02a07"
 
-inherit pypi setuptools3
+SRC_URI = " \
+    git://github.com/dsoprea/pyinotify.git;branch=master;protocol=https \
+    file://run-ptest \
+"
+
+SRCREV = "f77596ae965e47124f38d7bd6587365924dcd8f7"
+
+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/
+}