Skip to contentSkip to conversation

python3-inotify: fix tests

PATCH Superseded [email protected] 2 participants 3 messages Jul 27, 2023 – Jul 28, 2023

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 python3-inotify: fix tests

From: Joe Slater <[email protected]>

Some tests in test-inotify.py assume values for watch descriptors. This is not safe, so we retrieve the assigned values to compare with event information generated.

---
 .../python3-inotify/new-test-inotify.patch    | 620 ++++++++++++++++++
 .../python/python3-inotify_git.bb             |   1 +
 2 files changed, 621 insertions(+)
 create mode 100644 meta-python/recipes-devtools/python/python3-inotify/new-test-inotify.patch
meta-python/recipes-devtools/python/python3-inotify/new-test-inotify.patch new file +620 -0
new file mode 100644
index 0000000000..08ef4fd3d6
@@ -0,0 +1,620 @@
+From 80010e27d774e8b722d569384492eaab2bc4ac61 Mon Sep 17 00:00:00 2001
+From: Joe Slater <[email protected]>
+Date: Thu, 27 Jul 2023 15:01:04 +0000
+Subject: [PATCH] working commit
+
+It is not safe to assume the values returned by add_watch(),
+so we add a local helper get_wd() to retrieve them.  This fixes
+a problem in TestInotifyTree.test__cycle() where the
+wd's for the 'aa' and 'bb' paths are not '2' and '3',
+respectively.
+
+A second issue is that Inotify._get_event_names() should
+return a set or sorted list to avoid comparison problems,
+but that is not addressed here since it could be viewed as
+changing the API.
+
+This test_inotify.py is based on the version in the fix_tests branch of
+pyinotify as of commit d7d3c58...
+
+Upstream-Status: Submitted [to maintainer [email protected]]
+
+Signed-off-by: Joe Slater <[email protected]>
+---
+ tests/test_inotify.py | 346 ++++++++++++++++++++++++++++++++----------
+ 1 file changed, 262 insertions(+), 84 deletions(-)
+
+diff --git a/tests/test_inotify.py b/tests/test_inotify.py
+index d9f1f84..d89a49e 100644
+--- a/tests/test_inotify.py
++++ b/tests/test_inotify.py
+@@ -2,6 +2,7 @@
+ 
+ import os
+ import unittest
++import time
+ 
+ import inotify.constants
+ import inotify.calls
+@@ -15,6 +16,11 @@ except NameError:
+ else:
+     _HAS_PYTHON2_UNICODE_SUPPORT = True
+ 
++# Inotify does not have a get for watch descriptors
++# 
++def get_wd(i, path):
++    return i._Inotify__watches[path]
++
+ 
+ class TestInotify(unittest.TestCase):
+     def __init__(self, *args, **kwargs):
+@@ -29,11 +35,11 @@ class TestInotify(unittest.TestCase):
+     @unittest.skipIf(_HAS_PYTHON2_UNICODE_SUPPORT is True, "Not in Python 3")
+     def test__international_naming_python3(self):
+         with inotify.test_support.temp_path() as path:
+-            inner_path = os.path.join(path, '新增資料夾')
++            inner_path = os.path.join(path, u'新增資料夾')
+             os.mkdir(inner_path)
+ 
+             i = inotify.adapters.Inotify()
+-            i.add_watch(inner_path)
++            wd = i.add_watch(inner_path)
+ 
+             with open(os.path.join(inner_path, 'filename'), 'w'):
+                 pass
+@@ -41,12 +47,27 @@ class TestInotify(unittest.TestCase):
+             events = self.__read_all_events(i)
+ 
+             expected = [
+-                (inotify.adapters._INOTIFY_EVENT(wd=1, mask=256, cookie=0, len=16), ['IN_CREATE'], inner_path, 'filename'),
+-                (inotify.adapters._INOTIFY_EVENT(wd=1, mask=32, cookie=0, len=16), ['IN_OPEN'], inner_path, 'filename'),
+-                (inotify.adapters._INOTIFY_EVENT(wd=1, mask=8, cookie=0, len=16), ['IN_CLOSE_WRITE'], inner_path, 'filename'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd, mask=256, cookie=0, len=16), ['IN_CREATE'], inner_path, 'filename'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd, mask=32, cookie=0, len=16), ['IN_OPEN'], inner_path, 'filename'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd, mask=8, cookie=0, len=16), ['IN_CLOSE_WRITE'], inner_path, 'filename'),
+             ]
+ 
+-            self.assertEquals(events, expected)
++            if events != expected:
++                print("ACTUAL:")
++                print("")
++
++                for i, event in enumerate(events):
++                    print(event)
++
++                print("")
++
++                print("EXPECTED:")
++                print("")
++
++                for i, event in enumerate(expected):
++                    print(event)
++
++                raise Exception("Events not correct.")
+ 
+     @unittest.skipIf(_HAS_PYTHON2_UNICODE_SUPPORT is False, "Not in Python 2")
+     def test__international_naming_python2(self):
+@@ -55,7 +76,7 @@ class TestInotify(unittest.TestCase):
+             os.mkdir(inner_path)
+ 
+             i = inotify.adapters.Inotify()
+-            i.add_watch(inner_path)
++            wd = i.add_watch(inner_path)
+ 
+             with open(os.path.join(inner_path, u'filename料夾'), 'w'):
+                 pass
+@@ -63,12 +84,28 @@ class TestInotify(unittest.TestCase):
+             events = self.__read_all_events(i)
+ 
+             expected = [
+-                (inotify.adapters._INOTIFY_EVENT(wd=1, mask=256, cookie=0, len=16), ['IN_CREATE'], inner_path, u'filename料夾'),
+-                (inotify.adapters._INOTIFY_EVENT(wd=1, mask=32, cookie=0, len=16), ['IN_OPEN'], inner_path, u'filename料夾'),
+-                (inotify.adapters._INOTIFY_EVENT(wd=1, mask=8, cookie=0, len=16), ['IN_CLOSE_WRITE'], inner_path, u'filename料夾'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd, mask=256, cookie=0, len=16), ['IN_CREATE'], inner_path, u'filename料夾'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd, mask=32, cookie=0, len=16), ['IN_OPEN'], inner_path, u'filename料夾'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd, mask=8, cookie=0, len=16), ['IN_CLOSE_WRITE'], inner_path, u'filename料夾'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd, mask=16, cookie=0, len=16), ['IN_CLOSE_NOWRITE'], inner_path, u'filename料夾'),
+             ]
+ 
+-            self.assertEquals(events, expected)
++            if events != expected:
++                print("ACTUAL:")
++                print("")
++
++                for i, event in enumerate(events):
++                    print(event)
++
++                print("")
++
++                print("EXPECTED:")
++                print("")
++
++                for i, event in enumerate(expected):
++                    print(event)
++
++                raise Exception("Events not correct.")
+ 
+     def test__cycle(self):
+         with inotify.test_support.temp_path() as path:
+@@ -79,7 +116,7 @@ class TestInotify(unittest.TestCase):
+             os.mkdir(path2)
+ 
+             i = inotify.adapters.Inotify()
+-            i.add_watch(path1)
++            wd = i.add_watch(path1)
+ 
+             with open('ignored_new_file', 'w'):
+                 pass
+@@ -96,32 +133,47 @@ class TestInotify(unittest.TestCase):
+ 
+             expected = [
+                 (
+-                    inotify.adapters._INOTIFY_EVENT(wd=1, mask=256, cookie=0, len=16),
++                    inotify.adapters._INOTIFY_EVENT(wd=wd, mask=256, cookie=0, len=16),
+                     ['IN_CREATE'],
+                     path1,
+                     'seen_new_file'
+                 ),
+                 (
+-                    inotify.adapters._INOTIFY_EVENT(wd=1, mask=32, cookie=0, len=16),
++                    inotify.adapters._INOTIFY_EVENT(wd=wd, mask=32, cookie=0, len=16),
+                     ['IN_OPEN'],
+                     path1,
+                     'seen_new_file'
+                 ),
+                 (
+-                    inotify.adapters._INOTIFY_EVENT(wd=1, mask=8, cookie=0, len=16),
++                    inotify.adapters._INOTIFY_EVENT(wd=wd, mask=8, cookie=0, len=16),
+                     ['IN_CLOSE_WRITE'],
+                     path1,
+                     'seen_new_file'
+                 ),
+                 (
+-                    inotify.adapters._INOTIFY_EVENT(wd=1, mask=512, cookie=0, len=16),
++                    inotify.adapters._INOTIFY_EVENT(wd=wd, mask=512, cookie=0, len=16),
+                     ['IN_DELETE'],
+                     path1,
+                     'seen_new_file'
+                 )
+             ]
+ 
+-            self.assertEquals(events, expected)
++            if events != expected:
++                print("ACTUAL:")
++                print("")
++
++                for i, event in enumerate(events):
++                    print(event)
++
++                print("")
++
++                print("EXPECTED:")
++                print("")
++
++                for i, event in enumerate(expected):
++                    print(event)
++
++                raise Exception("Events not correct.")
+ 
+             # This can't be removed until *after* we've read the events because
+             # they'll be flushed the moment we remove the watch.
+@@ -131,7 +183,7 @@ class TestInotify(unittest.TestCase):
+                 pass
+ 
+             events = self.__read_all_events(i)
+-            self.assertEquals(events, [])
++            self.assertEqual(events, [])
+ 
+     @staticmethod
+     def _open_write_close(*args):
+@@ -167,23 +219,47 @@ class TestInotify(unittest.TestCase):
+         with inotify.test_support.temp_path() as path:
+             path1 = TestInotify._make_temp_path(path, 'aa')
+             path2 = TestInotify._make_temp_path(path, 'bb')
++
+             i = inotify.adapters.Inotify([path1, path2])
++
+             TestInotify._open_write_close('ignored_new_file')
+             TestInotify._open_write_close(path1, 'seen_new_file')
+             TestInotify._open_write_close(path2, 'seen_new_file2')
++            
++            wd_path1 = get_wd(i, path1)
++            wd_path2 = get_wd(i, path2)
++
++
+             os.remove(os.path.join(path1, 'seen_new_file'))
++
+             events = self.__read_all_events(i)
++
+             expected = [
+-                TestInotify._event_create(wd=1, path=path1, filename='seen_new_file'),
+-                TestInotify._event_open(wd=1, path=path1, filename='seen_new_file'),
+-                TestInotify._event_close_write(wd=1, path=path1, filename='seen_new_file'),
+-                TestInotify._event_create(wd=2, path=path2, filename='seen_new_file2'),
+-                TestInotify._event_open(wd=2, path=path2, filename='seen_new_file2'),
+-                TestInotify._event_close_write(wd=2, path=path2, filename='seen_new_file2'),
+-                TestInotify._event_general(wd=1, mask=512, type_name='IN_DELETE',
+-                                           path=path1, filename='seen_new_file')
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path1, mask=256, cookie=0, len=16), ['IN_CREATE'], path1, u'seen_new_file'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path1, mask=32, cookie=0, len=16), ['IN_OPEN'], path1, u'seen_new_file'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path1, mask=8, cookie=0, len=16), ['IN_CLOSE_WRITE'], path1, u'seen_new_file'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path2, mask=256, cookie=0, len=16), ['IN_CREATE'], path2, u'seen_new_file2'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path2, mask=32, cookie=0, len=16), ['IN_OPEN'], path2, u'seen_new_file2'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path2, mask=8, cookie=0, len=16), ['IN_CLOSE_WRITE'], path2, u'seen_new_file2'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path1, mask=512, cookie=0, len=16), ['IN_DELETE'], path1, u'seen_new_file'),
+             ]
+-            self.assertEquals(events, expected)
++
++            if events != expected:
++                print("ACTUAL:")
++                print("")
++
++                for i, event in enumerate(events):
++                    print(event)
++
++                print("")
++
++                print("EXPECTED:")
++                print("")
++
++                for i, event in enumerate(expected):
++                    print(event)
++
++                raise Exception("Events not correct.")
+ 
+     def test__error_on_watch_nonexistent_folder(self):
+         i = inotify.adapters.Inotify()
+@@ -201,7 +277,7 @@ class TestInotify(unittest.TestCase):
+         i = inotify.adapters.Inotify()
+         names = i._get_event_names(all_mask)
+ 
+-        self.assertEquals(names, all_names)
++        self.assertEqual(names, all_names)
+ 
+ 
+ class TestInotifyTree(unittest.TestCase):
+@@ -219,56 +295,101 @@ class TestInotifyTree(unittest.TestCase):
+             path1 = os.path.join(path, 'aa')
+             os.mkdir(path1)
+ 
++            time.sleep(.10)
++
+             path2 = os.path.join(path, 'bb')
+             os.mkdir(path2)
+ 
++            time.sleep(.10)
++
+             i = inotify.adapters.InotifyTree(path)
+ 
+             with open('seen_new_file1', 'w'):
+                 pass
+ 
++            time.sleep(.10)
++
+             with open(os.path.join(path1, 'seen_new_file2'), 'w'):
+                 pass
+ 
++            time.sleep(.10)
++
+             with open(os.path.join(path2, 'seen_new_file3'), 'w'):
+                 pass
+ 
++            time.sleep(.10)
++            
++            wd_path  = get_wd(i.inotify, path)
++            wd_path1 = get_wd(i.inotify, path1)
++            wd_path2 = get_wd(i.inotify, path2)
++
+             os.remove(os.path.join(path, 'seen_new_file1'))
++
++            time.sleep(.10)
++
+             os.remove(os.path.join(path1, 'seen_new_file2'))
++
++            time.sleep(.10)
++
+             os.remove(os.path.join(path2, 'seen_new_file3'))
+ 
++            time.sleep(.10)
++
+             os.rmdir(path1)
++
++            time.sleep(.10)
++
+             os.rmdir(path2)
+ 
+-            events = self.__read_all_events(i)
++            time.sleep(.10)
+ 
++            events = self.__read_all_events(i)
++            events = sorted(events)
++            
+             expected = [
+-                (inotify.adapters._INOTIFY_EVENT(wd=1, mask=256, cookie=0, len=16), ['IN_CREATE'], path, 'seen_new_file1'),
+-                (inotify.adapters._INOTIFY_EVENT(wd=1, mask=32, cookie=0, len=16), ['IN_OPEN'], path, 'seen_new_file1'),
+-                (inotify.adapters._INOTIFY_EVENT(wd=1, mask=8, cookie=0, len=16), ['IN_CLOSE_WRITE'], path, 'seen_new_file1'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path, mask=256, cookie=0, len=16), ['IN_CREATE'], path, 'seen_new_file1'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path, mask=32, cookie=0, len=16), ['IN_OPEN'], path, 'seen_new_file1'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path, mask=8, cookie=0, len=16), ['IN_CLOSE_WRITE'], path, 'seen_new_file1'),
+ 
+-                (inotify.adapters._INOTIFY_EVENT(wd=2, mask=256, cookie=0, len=16), ['IN_CREATE'], path1, 'seen_new_file2'),
+-                (inotify.adapters._INOTIFY_EVENT(wd=2, mask=32, cookie=0, len=16), ['IN_OPEN'], path1, 'seen_new_file2'),
+-                (inotify.adapters._INOTIFY_EVENT(wd=2, mask=8, cookie=0, len=16), ['IN_CLOSE_WRITE'], path1, 'seen_new_file2'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path1, mask=256, cookie=0, len=16), ['IN_CREATE'], path1, 'seen_new_file2'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path1, mask=32, cookie=0, len=16), ['IN_OPEN'], path1, 'seen_new_file2'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path1, mask=8, cookie=0, len=16), ['IN_CLOSE_WRITE'], path1, 'seen_new_file2'),
+ 
+-                (inotify.adapters._INOTIFY_EVENT(wd=3, mask=256, cookie=0, len=16), ['IN_CREATE'], path2, 'seen_new_file3'),
+-                (inotify.adapters._INOTIFY_EVENT(wd=3, mask=32, cookie=0, len=16), ['IN_OPEN'], path2, 'seen_new_file3'),
+-                (inotify.adapters._INOTIFY_EVENT(wd=3, mask=8, cookie=0, len=16), ['IN_CLOSE_WRITE'], path2, 'seen_new_file3'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path2, mask=256, cookie=0, len=16), ['IN_CREATE'], path2, 'seen_new_file3'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path2, mask=32, cookie=0, len=16), ['IN_OPEN'], path2, 'seen_new_file3'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path2, mask=8, cookie=0, len=16), ['IN_CLOSE_WRITE'], path2, 'seen_new_file3'),
+ 
+-                (inotify.adapters._INOTIFY_EVENT(wd=1, mask=512, cookie=0, len=16), ['IN_DELETE'], path, 'seen_new_file1'),
+-                (inotify.adapters._INOTIFY_EVENT(wd=2, mask=512, cookie=0, len=16), ['IN_DELETE'], path1, 'seen_new_file2'),
+-                (inotify.adapters._INOTIFY_EVENT(wd=3, mask=512, cookie=0, len=16), ['IN_DELETE'], path2, 'seen_new_file3'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path, mask=512, cookie=0, len=16), ['IN_DELETE'], path, 'seen_new_file1'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path1, mask=512, cookie=0, len=16), ['IN_DELETE'], path1, 'seen_new_file2'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path2, mask=512, cookie=0, len=16), ['IN_DELETE'], path2, 'seen_new_file3'),
+ 
+-                (inotify.adapters._INOTIFY_EVENT(wd=2, mask=1024, cookie=0, len=0), ['IN_DELETE_SELF'], path1, ''),
+-                (inotify.adapters._INOTIFY_EVENT(wd=2, mask=32768, cookie=0, len=0), ['IN_IGNORED'], path1, ''),
+-                (inotify.adapters._INOTIFY_EVENT(wd=1, mask=1073742336, cookie=0, len=16), ['IN_ISDIR', 'IN_DELETE'], path, 'aa'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path1, mask=1024, cookie=0, len=0), ['IN_DELETE_SELF'], path1, ''),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path1, mask=32768, cookie=0, len=0), ['IN_IGNORED'], path1, ''),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path, mask=1073742336, cookie=0, len=16), ['IN_DELETE', 'IN_ISDIR'], path, 'aa'),
+ 
+-                (inotify.adapters._INOTIFY_EVENT(wd=3, mask=1024, cookie=0, len=0), ['IN_DELETE_SELF'], path2, ''),
+-                (inotify.adapters._INOTIFY_EVENT(wd=3, mask=32768, cookie=0, len=0), ['IN_IGNORED'], path2, ''),
+-                (inotify.adapters._INOTIFY_EVENT(wd=1, mask=1073742336, cookie=0, len=16), ['IN_ISDIR', 'IN_DELETE'], path, 'bb'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path2, mask=1024, cookie=0, len=0), ['IN_DELETE_SELF'], path2, ''),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path2, mask=32768, cookie=0, len=0), ['IN_IGNORED'], path2, ''),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path, mask=1073742336, cookie=0, len=16), ['IN_DELETE', 'IN_ISDIR'], path, 'bb'),
+             ]
+ 
+-            self.assertEquals(events, expected)
++            expected = sorted(expected)
++
++            if events != expected:
++                print("ACTUAL:")
++                print("")
++
++                for i, event in enumerate(events):
++                    print(event)
++
++                print("")
++
++                print("EXPECTED:")
++                print("")
++
++                for i, event in enumerate(expected):
++                    print(event)
++
++                raise Exception("Events not correct.")
+ 
+     def test__renames(self):
+ 
+@@ -283,26 +404,30 @@ class TestInotifyTree(unittest.TestCase):
+             new_path = os.path.join(path, 'new_folder')
+ 
+             os.mkdir(old_path)
++            
++            wd_path = get_wd(i.inotify, path)
+ 
+             events1 = self.__read_all_events(i)
+ 
+             expected = [
+-                (inotify.adapters._INOTIFY_EVENT(wd=1, mask=1073742080, cookie=events1[0][0].cookie, len=16), ['IN_ISDIR', 'IN_CREATE'], path, 'old_folder'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path, mask=1073742080, cookie=events1[0][0].cookie, len=16), ['IN_CREATE', 'IN_ISDIR'], path, 'old_folder'),
+             ]
+ 
+-            self.assertEquals(events1, expected)
+-
++            self.assertEqual(events1, expected)
+ 
+             os.rename(old_path, new_path)
+ 
++            wd_old_path = get_wd(i.inotify, old_path)
++
+             events2 = self.__read_all_events(i)
+ 
+             expected = [
+-                (inotify.adapters._INOTIFY_EVENT(wd=1, mask=1073741888, cookie=events2[0][0].cookie, len=16), ['IN_MOVED_FROM', 'IN_ISDIR'], path, 'old_folder'),
+-                (inotify.adapters._INOTIFY_EVENT(wd=1, mask=1073741952, cookie=events2[1][0].cookie, len=16), ['IN_MOVED_TO', 'IN_ISDIR'], path, 'new_folder'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path, mask=1073741888, cookie=events2[0][0].cookie, len=16), ['IN_MOVED_FROM', 'IN_ISDIR'], path, 'old_folder'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path, mask=1073741952, cookie=events2[1][0].cookie, len=16), ['IN_MOVED_TO', 'IN_ISDIR'], path, 'new_folder'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_old_path, mask=2048, cookie=0, len=0), ['IN_MOVE_SELF'], new_path, '')
+             ]
+ 
+-            self.assertEquals(events2, expected)
++            self.assertEqual(events2, expected)
+ 
+ 
+             with open(os.path.join(new_path, 'old_filename'), 'w'):
+@@ -318,21 +443,33 @@ class TestInotifyTree(unittest.TestCase):
+             events3 = self.__read_all_events(i)
+ 
+             expected = [
+-                (inotify.adapters._INOTIFY_EVENT(wd=3, mask=256, cookie=0, len=16), ['IN_CREATE'], new_path, 'old_filename'),
+-                (inotify.adapters._INOTIFY_EVENT(wd=3, mask=32, cookie=0, len=16), ['IN_OPEN'], new_path, 'old_filename'),
+-                (inotify.adapters._INOTIFY_EVENT(wd=3, mask=8, cookie=0, len=16), ['IN_CLOSE_WRITE'], new_path, 'old_filename'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_old_path, mask=256, cookie=0, len=16), ['IN_CREATE'], new_path, 'old_filename'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_old_path, mask=32, cookie=0, len=16), ['IN_OPEN'], new_path, 'old_filename'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_old_path, mask=8, cookie=0, len=16), ['IN_CLOSE_WRITE'], new_path, 'old_filename'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_old_path, mask=64, cookie=events3[3][0].cookie, len=16), ['IN_MOVED_FROM'], new_path, 'old_filename'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_old_path, mask=128, cookie=events3[4][0].cookie, len=16), ['IN_MOVED_TO'], new_path, 'new_filename'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_old_path, mask=512, cookie=0, len=16), ['IN_DELETE'], new_path, 'new_filename'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_old_path, mask=1024, cookie=0, len=0), ['IN_DELETE_SELF'], new_path, ''),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_old_path, mask=32768, cookie=0, len=0), ['IN_IGNORED'], new_path, ''),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path, mask=1073742336, cookie=0, len=16), ['IN_DELETE', 'IN_ISDIR'], path, 'new_folder'),
++            ]
+ 
+-                (inotify.adapters._INOTIFY_EVENT(wd=3, mask=64, cookie=events3[3][0].cookie, len=16), ['IN_MOVED_FROM'], new_path, 'old_filename'),
+-                (inotify.adapters._INOTIFY_EVENT(wd=3, mask=128, cookie=events3[4][0].cookie, len=16), ['IN_MOVED_TO'], new_path, 'new_filename'),
++            if events3 != expected:
++                print("ACTUAL:")
++                print("")
+ 
+-                (inotify.adapters._INOTIFY_EVENT(wd=3, mask=512, cookie=0, len=16), ['IN_DELETE'], new_path, 'new_filename'),
++                for i, event in enumerate(events3):
++                    print(event)
+ 
+-                (inotify.adapters._INOTIFY_EVENT(wd=3, mask=1024, cookie=0, len=0), ['IN_DELETE_SELF'], new_path, ''),
+-                (inotify.adapters._INOTIFY_EVENT(wd=3, mask=32768, cookie=0, len=0), ['IN_IGNORED'], new_path, ''),
+-                (inotify.adapters._INOTIFY_EVENT(wd=1, mask=1073742336, cookie=0, len=16), ['IN_ISDIR', 'IN_DELETE'], path, 'new_folder'),
+-            ]
++                print("")
++
++                print("EXPECTED:")
++                print("")
+ 
+-            self.assertEquals(events3, expected)
++                for i, event in enumerate(expected):
++                    print(event)
++
++                raise Exception("Events not correct.")
+ 
+     def test__automatic_new_watches_on_new_paths(self):
+ 
+@@ -346,39 +483,60 @@ class TestInotifyTree(unittest.TestCase):
+             path2 = os.path.join(path1, 'folder2')
+ 
+             os.mkdir(path1)
++ 
++            wd_path = get_wd(i.inotify, path)
+ 
+             events = self.__read_all_events(i)
+ 
+             expected = [
+-                (inotify.adapters._INOTIFY_EVENT(wd=1, mask=1073742080, cookie=0, len=16), ['IN_ISDIR', 'IN_CREATE'], path, 'folder1'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path, mask=1073742080, cookie=0, len=16), ['IN_CREATE', 'IN_ISDIR'], path, 'folder1'),
+             ]
+ 
+-            self.assertEquals(events, expected)
++            self.assertEqual(events, expected)
+ 
+ 
+             os.mkdir(path2)
+ 
++            wd_path1 = get_wd(i.inotify, path1)
++
+             events = self.__read_all_events(i)
+ 
+             expected = [
+-                (inotify.adapters._INOTIFY_EVENT(wd=2, mask=1073742080, cookie=0, len=16), ['IN_ISDIR', 'IN_CREATE'], path1, 'folder2'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path1, mask=1073742080, cookie=0, len=16), ['IN_CREATE', 'IN_ISDIR'], path1, 'folder2'),
+             ]
+ 
+-            self.assertEquals(events, expected)
++            self.assertEqual(events, expected)
+ 
+ 
+             with open(os.path.join(path2,'filename'), 'w'):
+                 pass
+ 
++            wd_path2 = get_wd(i.inotify, path2)
++
+             events = self.__read_all_events(i)
+ 
+             expected = [
+-                (inotify.adapters._INOTIFY_EVENT(wd=3, mask=256, cookie=0, len=16), ['IN_CREATE'], path2, 'filename'),
+-                (inotify.adapters._INOTIFY_EVENT(wd=3, mask=32, cookie=0, len=16), ['IN_OPEN'], path2, 'filename'),
+-                (inotify.adapters._INOTIFY_EVENT(wd=3, mask=8, cookie=0, len=16), ['IN_CLOSE_WRITE'], path2, 'filename'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path2, mask=256, cookie=0, len=16), ['IN_CREATE'], path2, 'filename'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path2, mask=32, cookie=0, len=16), ['IN_OPEN'], path2, 'filename'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path2, mask=8, cookie=0, len=16), ['IN_CLOSE_WRITE'], path2, 'filename'),
+             ]
+ 
+-            self.assertEquals(events, expected)
++            if events != expected:
++                print("ACTUAL:")
++                print("")
++
++                for i, event in enumerate(events):
++                    print(event)
++
++                print("")
++
++                print("EXPECTED:")
++                print("")
++
++                for i, event in enumerate(expected):
++                    print(event)
++
++                raise Exception("Events not correct.")
+ 
+     def test__automatic_new_watches_on_existing_paths(self):
+ 
+@@ -396,16 +554,33 @@ class TestInotifyTree(unittest.TestCase):
+ 
+             with open(os.path.join(path2,'filename'), 'w'):
+                 pass
++                
++            wd = get_wd(i.inotify, path2)
+ 
+             events = self.__read_all_events(i)
+ 
+             expected = [
+-                (inotify.adapters._INOTIFY_EVENT(wd=3, mask=256, cookie=0, len=16), ['IN_CREATE'], path2, 'filename'),
+-                (inotify.adapters._INOTIFY_EVENT(wd=3, mask=32, cookie=0, len=16), ['IN_OPEN'], path2, 'filename'),
+-                (inotify.adapters._INOTIFY_EVENT(wd=3, mask=8, cookie=0, len=16), ['IN_CLOSE_WRITE'], path2, 'filename'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd, mask=256, cookie=0, len=16), ['IN_CREATE'], path2, 'filename'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd, mask=32, cookie=0, len=16), ['IN_OPEN'], path2, 'filename'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd, mask=8, cookie=0, len=16), ['IN_CLOSE_WRITE'], path2, 'filename'),
+             ]
+ 
+-            self.assertEquals(events, expected)
++            if events != expected:
++                print("ACTUAL:")
++                print("")
++
++                for i, event in enumerate(events):
++                    print(event)
++
++                print("")
++
++                print("EXPECTED:")
++                print("")
++
++                for i, event in enumerate(expected):
++                    print(event)
++
++                raise Exception("Events not correct.")
+ 
+ 
+ class TestInotifyTrees(unittest.TestCase):
+@@ -428,6 +603,9 @@ class TestInotifyTrees(unittest.TestCase):
+ 
+             i = inotify.adapters.InotifyTrees([path1, path2])
+ 
++            wd_path1 = get_wd(i.inotify, path1)
++            wd_path2 = get_wd(i.inotify, path2)
++
+             with open(os.path.join(path1, 'seen_new_file1'), 'w'):
+                 pass
+ 
+@@ -437,13 +615,13 @@ class TestInotifyTrees(unittest.TestCase):
+             events = self.__read_all_events(i)
+ 
+             expected = [
+-                (inotify.adapters._INOTIFY_EVENT(wd=1, mask=256, cookie=0, len=16), ['IN_CREATE'], path1, 'seen_new_file1'),
+-                (inotify.adapters._INOTIFY_EVENT(wd=1, mask=32, cookie=0, len=16), ['IN_OPEN'], path1, 'seen_new_file1'),
+-                (inotify.adapters._INOTIFY_EVENT(wd=1, mask=8, cookie=0, len=16), ['IN_CLOSE_WRITE'], path1, 'seen_new_file1'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path1, mask=256, cookie=0, len=16), ['IN_CREATE'], path1, 'seen_new_file1'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path1, mask=32, cookie=0, len=16), ['IN_OPEN'], path1, 'seen_new_file1'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path1, mask=8, cookie=0, len=16), ['IN_CLOSE_WRITE'], path1, 'seen_new_file1'),
+ 
+-                (inotify.adapters._INOTIFY_EVENT(wd=2, mask=256, cookie=0, len=16), ['IN_CREATE'], path2, 'seen_new_file2'),
+-                (inotify.adapters._INOTIFY_EVENT(wd=2, mask=32, cookie=0, len=16), ['IN_OPEN'], path2, 'seen_new_file2'),
+-                (inotify.adapters._INOTIFY_EVENT(wd=2, mask=8, cookie=0, len=16), ['IN_CLOSE_WRITE'], path2, 'seen_new_file2'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path2, mask=256, cookie=0, len=16), ['IN_CREATE'], path2, 'seen_new_file2'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path2, mask=32, cookie=0, len=16), ['IN_OPEN'], path2, 'seen_new_file2'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path2, mask=8, cookie=0, len=16), ['IN_CLOSE_WRITE'], path2, 'seen_new_file2'),
+             ]
+ 
+-            self.assertEquals(events, expected)
++            self.assertEqual(events, expected)
+-- 
+2.35.5
+
meta-python/recipes-devtools/python/python3-inotify_git.bb +1 -0
index 15fb92eedd..37a2e2a6f2 100644
@@ -8,6 +8,7 @@ SRC_URI[sha256sum] = "974a623a338482b62e16d4eb705fb863ed33ec178680fc3e96ccdf0df6
 
 SRC_URI = " \
     git://github.com/dsoprea/pyinotify.git;branch=master;protocol=https \
+    file://new-test-inotify.patch \
     file://run-ptest \
 "
 
Signature · 1 line
2.25.1
#1 lore raw
Quoted 30 lines · Joe Slater via lists.openembedded.org

From: Joe Slater <[email protected]>

Some tests in test-inotify.py assume values for watch descriptors. This is not safe, so we retrieve the assigned values to compare with event information generated.

---
 .../python3-inotify/new-test-inotify.patch    | 620 ++++++++++++++++++
 .../python/python3-inotify_git.bb             |   1 +
 2 files changed, 621 insertions(+)
 create mode 100644 meta-python/recipes-devtools/python/python3-inotify/new-test-inotify.patch
meta-python/recipes-devtools/python/python3-inotify/new-test-inotify.patch new file +10 -0
new file mode 100644
index 0000000000..08ef4fd3d6
@@ -0,0 +1,620 @@
+From 80010e27d774e8b722d569384492eaab2bc4ac61 Mon Sep 17 00:00:00 2001
+From: Joe Slater <[email protected]>
+Date: Thu, 27 Jul 2023 15:01:04 +0000
+Subject: [PATCH] working commit
+
+It is not safe to assume the values returned by add_watch(),
+so we add a local helper get_wd() to retrieve them.  This fixes
+a problem in TestInotifyTree.test__cycle() where the
+wd's for the 'aa' and 'bb' paths are not '2' and '3',
+respectively.

meta-python/recipes-devtools/python/python3-inotify/new-test-inotify.patch line 20

Quoted 10 lines
meta-python/recipes-devtools/python/python3-inotify/new-test-inotify.patch new file +10 -0
+
+A second issue is that Inotify._get_event_names() should
+return a set or sorted list to avoid comparison problems,
+but that is not addressed here since it could be viewed as
+changing the API.
+
+This test_inotify.py is based on the version in the fix_tests branch of
+pyinotify as of commit d7d3c58...
+
+Upstream-Status: Submitted [to maintainer [email protected]]

hmmm, why not create a github PR at
https://github.com/dsoprea/pyinotify

Quoted 624 lines
meta-python/recipes-devtools/python/python3-inotify/new-test-inotify.patch new file +600 -0
+
+Signed-off-by: Joe Slater <[email protected]>
+---
+ tests/test_inotify.py | 346 ++++++++++++++++++++++++++++++++----------
+ 1 file changed, 262 insertions(+), 84 deletions(-)
+
+diff --git a/tests/test_inotify.py b/tests/test_inotify.py
+index d9f1f84..d89a49e 100644
+--- a/tests/test_inotify.py
++++ b/tests/test_inotify.py
+@@ -2,6 +2,7 @@
+
+ import os
+ import unittest
++import time
+
+ import inotify.constants
+ import inotify.calls
+@@ -15,6 +16,11 @@ except NameError:
+ else:
+     _HAS_PYTHON2_UNICODE_SUPPORT = True
+
++# Inotify does not have a get for watch descriptors
++#
++def get_wd(i, path):
++    return i._Inotify__watches[path]
++
+
+ class TestInotify(unittest.TestCase):
+     def __init__(self, *args, **kwargs):
+@@ -29,11 +35,11 @@ class TestInotify(unittest.TestCase):
+     @unittest.skipIf(_HAS_PYTHON2_UNICODE_SUPPORT is True, "Not in Python 3")
+     def test__international_naming_python3(self):
+         with inotify.test_support.temp_path() as path:
+-            inner_path = os.path.join(path, '新增資料夾')
++            inner_path = os.path.join(path, u'新增資料夾')
+             os.mkdir(inner_path)
+
+             i = inotify.adapters.Inotify()
+-            i.add_watch(inner_path)
++            wd = i.add_watch(inner_path)
+
+             with open(os.path.join(inner_path, 'filename'), 'w'):
+                 pass
+@@ -41,12 +47,27 @@ class TestInotify(unittest.TestCase):
+             events = self.__read_all_events(i)
+
+             expected = [
+-                (inotify.adapters._INOTIFY_EVENT(wd=1, mask=256, cookie=0, len=16), ['IN_CREATE'], inner_path, 'filename'),
+-                (inotify.adapters._INOTIFY_EVENT(wd=1, mask=32, cookie=0, len=16), ['IN_OPEN'], inner_path, 'filename'),
+-                (inotify.adapters._INOTIFY_EVENT(wd=1, mask=8, cookie=0, len=16), ['IN_CLOSE_WRITE'], inner_path, 'filename'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd, mask=256, cookie=0, len=16), ['IN_CREATE'], inner_path, 'filename'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd, mask=32, cookie=0, len=16), ['IN_OPEN'], inner_path, 'filename'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd, mask=8, cookie=0, len=16), ['IN_CLOSE_WRITE'], inner_path, 'filename'),
+             ]
+
+-            self.assertEquals(events, expected)
++            if events != expected:
++                print("ACTUAL:")
++                print("")
++
++                for i, event in enumerate(events):
++                    print(event)
++
++                print("")
++
++                print("EXPECTED:")
++                print("")
++
++                for i, event in enumerate(expected):
++                    print(event)
++
++                raise Exception("Events not correct.")
+
+     @unittest.skipIf(_HAS_PYTHON2_UNICODE_SUPPORT is False, "Not in Python 2")
+     def test__international_naming_python2(self):
+@@ -55,7 +76,7 @@ class TestInotify(unittest.TestCase):
+             os.mkdir(inner_path)
+
+             i = inotify.adapters.Inotify()
+-            i.add_watch(inner_path)
++            wd = i.add_watch(inner_path)
+
+             with open(os.path.join(inner_path, u'filename料夾'), 'w'):
+                 pass
+@@ -63,12 +84,28 @@ class TestInotify(unittest.TestCase):
+             events = self.__read_all_events(i)
+
+             expected = [
+-                (inotify.adapters._INOTIFY_EVENT(wd=1, mask=256, cookie=0, len=16), ['IN_CREATE'], inner_path, u'filename料夾'),
+-                (inotify.adapters._INOTIFY_EVENT(wd=1, mask=32, cookie=0, len=16), ['IN_OPEN'], inner_path, u'filename料夾'),
+-                (inotify.adapters._INOTIFY_EVENT(wd=1, mask=8, cookie=0, len=16), ['IN_CLOSE_WRITE'], inner_path, u'filename料夾'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd, mask=256, cookie=0, len=16), ['IN_CREATE'], inner_path, u'filename料夾'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd, mask=32, cookie=0, len=16), ['IN_OPEN'], inner_path, u'filename料夾'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd, mask=8, cookie=0, len=16), ['IN_CLOSE_WRITE'], inner_path, u'filename料夾'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd, mask=16, cookie=0, len=16), ['IN_CLOSE_NOWRITE'], inner_path, u'filename料夾'),
+             ]
+
+-            self.assertEquals(events, expected)
++            if events != expected:
++                print("ACTUAL:")
++                print("")
++
++                for i, event in enumerate(events):
++                    print(event)
++
++                print("")
++
++                print("EXPECTED:")
++                print("")
++
++                for i, event in enumerate(expected):
++                    print(event)
++
++                raise Exception("Events not correct.")
+
+     def test__cycle(self):
+         with inotify.test_support.temp_path() as path:
+@@ -79,7 +116,7 @@ class TestInotify(unittest.TestCase):
+             os.mkdir(path2)
+
+             i = inotify.adapters.Inotify()
+-            i.add_watch(path1)
++            wd = i.add_watch(path1)
+
+             with open('ignored_new_file', 'w'):
+                 pass
+@@ -96,32 +133,47 @@ class TestInotify(unittest.TestCase):
+
+             expected = [
+                 (
+-                    inotify.adapters._INOTIFY_EVENT(wd=1, mask=256, cookie=0, len=16),
++                    inotify.adapters._INOTIFY_EVENT(wd=wd, mask=256, cookie=0, len=16),
+                     ['IN_CREATE'],
+                     path1,
+                     'seen_new_file'
+                 ),
+                 (
+-                    inotify.adapters._INOTIFY_EVENT(wd=1, mask=32, cookie=0, len=16),
++                    inotify.adapters._INOTIFY_EVENT(wd=wd, mask=32, cookie=0, len=16),
+                     ['IN_OPEN'],
+                     path1,
+                     'seen_new_file'
+                 ),
+                 (
+-                    inotify.adapters._INOTIFY_EVENT(wd=1, mask=8, cookie=0, len=16),
++                    inotify.adapters._INOTIFY_EVENT(wd=wd, mask=8, cookie=0, len=16),
+                     ['IN_CLOSE_WRITE'],
+                     path1,
+                     'seen_new_file'
+                 ),
+                 (
+-                    inotify.adapters._INOTIFY_EVENT(wd=1, mask=512, cookie=0, len=16),
++                    inotify.adapters._INOTIFY_EVENT(wd=wd, mask=512, cookie=0, len=16),
+                     ['IN_DELETE'],
+                     path1,
+                     'seen_new_file'
+                 )
+             ]
+
+-            self.assertEquals(events, expected)
++            if events != expected:
++                print("ACTUAL:")
++                print("")
++
++                for i, event in enumerate(events):
++                    print(event)
++
++                print("")
++
++                print("EXPECTED:")
++                print("")
++
++                for i, event in enumerate(expected):
++                    print(event)
++
++                raise Exception("Events not correct.")
+
+             # This can't be removed until *after* we've read the events because
+             # they'll be flushed the moment we remove the watch.
+@@ -131,7 +183,7 @@ class TestInotify(unittest.TestCase):
+                 pass
+
+             events = self.__read_all_events(i)
+-            self.assertEquals(events, [])
++            self.assertEqual(events, [])
+
+     @staticmethod
+     def _open_write_close(*args):
+@@ -167,23 +219,47 @@ class TestInotify(unittest.TestCase):
+         with inotify.test_support.temp_path() as path:
+             path1 = TestInotify._make_temp_path(path, 'aa')
+             path2 = TestInotify._make_temp_path(path, 'bb')
++
+             i = inotify.adapters.Inotify([path1, path2])
++
+             TestInotify._open_write_close('ignored_new_file')
+             TestInotify._open_write_close(path1, 'seen_new_file')
+             TestInotify._open_write_close(path2, 'seen_new_file2')
++
++            wd_path1 = get_wd(i, path1)
++            wd_path2 = get_wd(i, path2)
++
++
+             os.remove(os.path.join(path1, 'seen_new_file'))
++
+             events = self.__read_all_events(i)
++
+             expected = [
+-                TestInotify._event_create(wd=1, path=path1, filename='seen_new_file'),
+-                TestInotify._event_open(wd=1, path=path1, filename='seen_new_file'),
+-                TestInotify._event_close_write(wd=1, path=path1, filename='seen_new_file'),
+-                TestInotify._event_create(wd=2, path=path2, filename='seen_new_file2'),
+-                TestInotify._event_open(wd=2, path=path2, filename='seen_new_file2'),
+-                TestInotify._event_close_write(wd=2, path=path2, filename='seen_new_file2'),
+-                TestInotify._event_general(wd=1, mask=512, type_name='IN_DELETE',
+-                                           path=path1, filename='seen_new_file')
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path1, mask=256, cookie=0, len=16), ['IN_CREATE'], path1, u'seen_new_file'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path1, mask=32, cookie=0, len=16), ['IN_OPEN'], path1, u'seen_new_file'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path1, mask=8, cookie=0, len=16), ['IN_CLOSE_WRITE'], path1, u'seen_new_file'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path2, mask=256, cookie=0, len=16), ['IN_CREATE'], path2, u'seen_new_file2'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path2, mask=32, cookie=0, len=16), ['IN_OPEN'], path2, u'seen_new_file2'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path2, mask=8, cookie=0, len=16), ['IN_CLOSE_WRITE'], path2, u'seen_new_file2'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path1, mask=512, cookie=0, len=16), ['IN_DELETE'], path1, u'seen_new_file'),
+             ]
+-            self.assertEquals(events, expected)
++
++            if events != expected:
++                print("ACTUAL:")
++                print("")
++
++                for i, event in enumerate(events):
++                    print(event)
++
++                print("")
++
++                print("EXPECTED:")
++                print("")
++
++                for i, event in enumerate(expected):
++                    print(event)
++
++                raise Exception("Events not correct.")
+
+     def test__error_on_watch_nonexistent_folder(self):
+         i = inotify.adapters.Inotify()
+@@ -201,7 +277,7 @@ class TestInotify(unittest.TestCase):
+         i = inotify.adapters.Inotify()
+         names = i._get_event_names(all_mask)
+
+-        self.assertEquals(names, all_names)
++        self.assertEqual(names, all_names)
+
+
+ class TestInotifyTree(unittest.TestCase):
+@@ -219,56 +295,101 @@ class TestInotifyTree(unittest.TestCase):
+             path1 = os.path.join(path, 'aa')
+             os.mkdir(path1)
+
++            time.sleep(.10)
++
+             path2 = os.path.join(path, 'bb')
+             os.mkdir(path2)
+
++            time.sleep(.10)
++
+             i = inotify.adapters.InotifyTree(path)
+
+             with open('seen_new_file1', 'w'):
+                 pass
+
++            time.sleep(.10)
++
+             with open(os.path.join(path1, 'seen_new_file2'), 'w'):
+                 pass
+
++            time.sleep(.10)
++
+             with open(os.path.join(path2, 'seen_new_file3'), 'w'):
+                 pass
+
++            time.sleep(.10)
++
++            wd_path  = get_wd(i.inotify, path)
++            wd_path1 = get_wd(i.inotify, path1)
++            wd_path2 = get_wd(i.inotify, path2)
++
+             os.remove(os.path.join(path, 'seen_new_file1'))
++
++            time.sleep(.10)
++
+             os.remove(os.path.join(path1, 'seen_new_file2'))
++
++            time.sleep(.10)
++
+             os.remove(os.path.join(path2, 'seen_new_file3'))
+
++            time.sleep(.10)
++
+             os.rmdir(path1)
++
++            time.sleep(.10)
++
+             os.rmdir(path2)
+
+-            events = self.__read_all_events(i)
++            time.sleep(.10)
+
++            events = self.__read_all_events(i)
++            events = sorted(events)
++
+             expected = [
+-                (inotify.adapters._INOTIFY_EVENT(wd=1, mask=256, cookie=0, len=16), ['IN_CREATE'], path, 'seen_new_file1'),
+-                (inotify.adapters._INOTIFY_EVENT(wd=1, mask=32, cookie=0, len=16), ['IN_OPEN'], path, 'seen_new_file1'),
+-                (inotify.adapters._INOTIFY_EVENT(wd=1, mask=8, cookie=0, len=16), ['IN_CLOSE_WRITE'], path, 'seen_new_file1'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path, mask=256, cookie=0, len=16), ['IN_CREATE'], path, 'seen_new_file1'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path, mask=32, cookie=0, len=16), ['IN_OPEN'], path, 'seen_new_file1'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path, mask=8, cookie=0, len=16), ['IN_CLOSE_WRITE'], path, 'seen_new_file1'),
+
+-                (inotify.adapters._INOTIFY_EVENT(wd=2, mask=256, cookie=0, len=16), ['IN_CREATE'], path1, 'seen_new_file2'),
+-                (inotify.adapters._INOTIFY_EVENT(wd=2, mask=32, cookie=0, len=16), ['IN_OPEN'], path1, 'seen_new_file2'),
+-                (inotify.adapters._INOTIFY_EVENT(wd=2, mask=8, cookie=0, len=16), ['IN_CLOSE_WRITE'], path1, 'seen_new_file2'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path1, mask=256, cookie=0, len=16), ['IN_CREATE'], path1, 'seen_new_file2'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path1, mask=32, cookie=0, len=16), ['IN_OPEN'], path1, 'seen_new_file2'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path1, mask=8, cookie=0, len=16), ['IN_CLOSE_WRITE'], path1, 'seen_new_file2'),
+
+-                (inotify.adapters._INOTIFY_EVENT(wd=3, mask=256, cookie=0, len=16), ['IN_CREATE'], path2, 'seen_new_file3'),
+-                (inotify.adapters._INOTIFY_EVENT(wd=3, mask=32, cookie=0, len=16), ['IN_OPEN'], path2, 'seen_new_file3'),
+-                (inotify.adapters._INOTIFY_EVENT(wd=3, mask=8, cookie=0, len=16), ['IN_CLOSE_WRITE'], path2, 'seen_new_file3'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path2, mask=256, cookie=0, len=16), ['IN_CREATE'], path2, 'seen_new_file3'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path2, mask=32, cookie=0, len=16), ['IN_OPEN'], path2, 'seen_new_file3'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path2, mask=8, cookie=0, len=16), ['IN_CLOSE_WRITE'], path2, 'seen_new_file3'),
+
+-                (inotify.adapters._INOTIFY_EVENT(wd=1, mask=512, cookie=0, len=16), ['IN_DELETE'], path, 'seen_new_file1'),
+-                (inotify.adapters._INOTIFY_EVENT(wd=2, mask=512, cookie=0, len=16), ['IN_DELETE'], path1, 'seen_new_file2'),
+-                (inotify.adapters._INOTIFY_EVENT(wd=3, mask=512, cookie=0, len=16), ['IN_DELETE'], path2, 'seen_new_file3'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path, mask=512, cookie=0, len=16), ['IN_DELETE'], path, 'seen_new_file1'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path1, mask=512, cookie=0, len=16), ['IN_DELETE'], path1, 'seen_new_file2'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path2, mask=512, cookie=0, len=16), ['IN_DELETE'], path2, 'seen_new_file3'),
+
+-                (inotify.adapters._INOTIFY_EVENT(wd=2, mask=1024, cookie=0, len=0), ['IN_DELETE_SELF'], path1, ''),
+-                (inotify.adapters._INOTIFY_EVENT(wd=2, mask=32768, cookie=0, len=0), ['IN_IGNORED'], path1, ''),
+-                (inotify.adapters._INOTIFY_EVENT(wd=1, mask=1073742336, cookie=0, len=16), ['IN_ISDIR', 'IN_DELETE'], path, 'aa'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path1, mask=1024, cookie=0, len=0), ['IN_DELETE_SELF'], path1, ''),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path1, mask=32768, cookie=0, len=0), ['IN_IGNORED'], path1, ''),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path, mask=1073742336, cookie=0, len=16), ['IN_DELETE', 'IN_ISDIR'], path, 'aa'),
+
+-                (inotify.adapters._INOTIFY_EVENT(wd=3, mask=1024, cookie=0, len=0), ['IN_DELETE_SELF'], path2, ''),
+-                (inotify.adapters._INOTIFY_EVENT(wd=3, mask=32768, cookie=0, len=0), ['IN_IGNORED'], path2, ''),
+-                (inotify.adapters._INOTIFY_EVENT(wd=1, mask=1073742336, cookie=0, len=16), ['IN_ISDIR', 'IN_DELETE'], path, 'bb'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path2, mask=1024, cookie=0, len=0), ['IN_DELETE_SELF'], path2, ''),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path2, mask=32768, cookie=0, len=0), ['IN_IGNORED'], path2, ''),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path, mask=1073742336, cookie=0, len=16), ['IN_DELETE', 'IN_ISDIR'], path, 'bb'),
+             ]
+
+-            self.assertEquals(events, expected)
++            expected = sorted(expected)
++
++            if events != expected:
++                print("ACTUAL:")
++                print("")
++
++                for i, event in enumerate(events):
++                    print(event)
++
++                print("")
++
++                print("EXPECTED:")
++                print("")
++
++                for i, event in enumerate(expected):
++                    print(event)
++
++                raise Exception("Events not correct.")
+
+     def test__renames(self):
+
+@@ -283,26 +404,30 @@ class TestInotifyTree(unittest.TestCase):
+             new_path = os.path.join(path, 'new_folder')
+
+             os.mkdir(old_path)
++
++            wd_path = get_wd(i.inotify, path)
+
+             events1 = self.__read_all_events(i)
+
+             expected = [
+-                (inotify.adapters._INOTIFY_EVENT(wd=1, mask=1073742080, cookie=events1[0][0].cookie, len=16), ['IN_ISDIR', 'IN_CREATE'], path, 'old_folder'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path, mask=1073742080, cookie=events1[0][0].cookie, len=16), ['IN_CREATE', 'IN_ISDIR'], path, 'old_folder'),
+             ]
+
+-            self.assertEquals(events1, expected)
+-
++            self.assertEqual(events1, expected)
+
+             os.rename(old_path, new_path)
+
++            wd_old_path = get_wd(i.inotify, old_path)
++
+             events2 = self.__read_all_events(i)
+
+             expected = [
+-                (inotify.adapters._INOTIFY_EVENT(wd=1, mask=1073741888, cookie=events2[0][0].cookie, len=16), ['IN_MOVED_FROM', 'IN_ISDIR'], path, 'old_folder'),
+-                (inotify.adapters._INOTIFY_EVENT(wd=1, mask=1073741952, cookie=events2[1][0].cookie, len=16), ['IN_MOVED_TO', 'IN_ISDIR'], path, 'new_folder'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path, mask=1073741888, cookie=events2[0][0].cookie, len=16), ['IN_MOVED_FROM', 'IN_ISDIR'], path, 'old_folder'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path, mask=1073741952, cookie=events2[1][0].cookie, len=16), ['IN_MOVED_TO', 'IN_ISDIR'], path, 'new_folder'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_old_path, mask=2048, cookie=0, len=0), ['IN_MOVE_SELF'], new_path, '')
+             ]
+
+-            self.assertEquals(events2, expected)
++            self.assertEqual(events2, expected)
+
+
+             with open(os.path.join(new_path, 'old_filename'), 'w'):
+@@ -318,21 +443,33 @@ class TestInotifyTree(unittest.TestCase):
+             events3 = self.__read_all_events(i)
+
+             expected = [
+-                (inotify.adapters._INOTIFY_EVENT(wd=3, mask=256, cookie=0, len=16), ['IN_CREATE'], new_path, 'old_filename'),
+-                (inotify.adapters._INOTIFY_EVENT(wd=3, mask=32, cookie=0, len=16), ['IN_OPEN'], new_path, 'old_filename'),
+-                (inotify.adapters._INOTIFY_EVENT(wd=3, mask=8, cookie=0, len=16), ['IN_CLOSE_WRITE'], new_path, 'old_filename'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_old_path, mask=256, cookie=0, len=16), ['IN_CREATE'], new_path, 'old_filename'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_old_path, mask=32, cookie=0, len=16), ['IN_OPEN'], new_path, 'old_filename'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_old_path, mask=8, cookie=0, len=16), ['IN_CLOSE_WRITE'], new_path, 'old_filename'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_old_path, mask=64, cookie=events3[3][0].cookie, len=16), ['IN_MOVED_FROM'], new_path, 'old_filename'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_old_path, mask=128, cookie=events3[4][0].cookie, len=16), ['IN_MOVED_TO'], new_path, 'new_filename'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_old_path, mask=512, cookie=0, len=16), ['IN_DELETE'], new_path, 'new_filename'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_old_path, mask=1024, cookie=0, len=0), ['IN_DELETE_SELF'], new_path, ''),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_old_path, mask=32768, cookie=0, len=0), ['IN_IGNORED'], new_path, ''),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path, mask=1073742336, cookie=0, len=16), ['IN_DELETE', 'IN_ISDIR'], path, 'new_folder'),
++            ]
+
+-                (inotify.adapters._INOTIFY_EVENT(wd=3, mask=64, cookie=events3[3][0].cookie, len=16), ['IN_MOVED_FROM'], new_path, 'old_filename'),
+-                (inotify.adapters._INOTIFY_EVENT(wd=3, mask=128, cookie=events3[4][0].cookie, len=16), ['IN_MOVED_TO'], new_path, 'new_filename'),
++            if events3 != expected:
++                print("ACTUAL:")
++                print("")
+
+-                (inotify.adapters._INOTIFY_EVENT(wd=3, mask=512, cookie=0, len=16), ['IN_DELETE'], new_path, 'new_filename'),
++                for i, event in enumerate(events3):
++                    print(event)
+
+-                (inotify.adapters._INOTIFY_EVENT(wd=3, mask=1024, cookie=0, len=0), ['IN_DELETE_SELF'], new_path, ''),
+-                (inotify.adapters._INOTIFY_EVENT(wd=3, mask=32768, cookie=0, len=0), ['IN_IGNORED'], new_path, ''),
+-                (inotify.adapters._INOTIFY_EVENT(wd=1, mask=1073742336, cookie=0, len=16), ['IN_ISDIR', 'IN_DELETE'], path, 'new_folder'),
+-            ]
++                print("")
++
++                print("EXPECTED:")
++                print("")
+
+-            self.assertEquals(events3, expected)
++                for i, event in enumerate(expected):
++                    print(event)
++
++                raise Exception("Events not correct.")
+
+     def test__automatic_new_watches_on_new_paths(self):
+
+@@ -346,39 +483,60 @@ class TestInotifyTree(unittest.TestCase):
+             path2 = os.path.join(path1, 'folder2')
+
+             os.mkdir(path1)
++
++            wd_path = get_wd(i.inotify, path)
+
+             events = self.__read_all_events(i)
+
+             expected = [
+-                (inotify.adapters._INOTIFY_EVENT(wd=1, mask=1073742080, cookie=0, len=16), ['IN_ISDIR', 'IN_CREATE'], path, 'folder1'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path, mask=1073742080, cookie=0, len=16), ['IN_CREATE', 'IN_ISDIR'], path, 'folder1'),
+             ]
+
+-            self.assertEquals(events, expected)
++            self.assertEqual(events, expected)
+
+
+             os.mkdir(path2)
+
++            wd_path1 = get_wd(i.inotify, path1)
++
+             events = self.__read_all_events(i)
+
+             expected = [
+-                (inotify.adapters._INOTIFY_EVENT(wd=2, mask=1073742080, cookie=0, len=16), ['IN_ISDIR', 'IN_CREATE'], path1, 'folder2'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path1, mask=1073742080, cookie=0, len=16), ['IN_CREATE', 'IN_ISDIR'], path1, 'folder2'),
+             ]
+
+-            self.assertEquals(events, expected)
++            self.assertEqual(events, expected)
+
+
+             with open(os.path.join(path2,'filename'), 'w'):
+                 pass
+
++            wd_path2 = get_wd(i.inotify, path2)
++
+             events = self.__read_all_events(i)
+
+             expected = [
+-                (inotify.adapters._INOTIFY_EVENT(wd=3, mask=256, cookie=0, len=16), ['IN_CREATE'], path2, 'filename'),
+-                (inotify.adapters._INOTIFY_EVENT(wd=3, mask=32, cookie=0, len=16), ['IN_OPEN'], path2, 'filename'),
+-                (inotify.adapters._INOTIFY_EVENT(wd=3, mask=8, cookie=0, len=16), ['IN_CLOSE_WRITE'], path2, 'filename'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path2, mask=256, cookie=0, len=16), ['IN_CREATE'], path2, 'filename'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path2, mask=32, cookie=0, len=16), ['IN_OPEN'], path2, 'filename'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path2, mask=8, cookie=0, len=16), ['IN_CLOSE_WRITE'], path2, 'filename'),
+             ]
+
+-            self.assertEquals(events, expected)
++            if events != expected:
++                print("ACTUAL:")
++                print("")
++
++                for i, event in enumerate(events):
++                    print(event)
++
++                print("")
++
++                print("EXPECTED:")
++                print("")
++
++                for i, event in enumerate(expected):
++                    print(event)
++
++                raise Exception("Events not correct.")
+
+     def test__automatic_new_watches_on_existing_paths(self):
+
+@@ -396,16 +554,33 @@ class TestInotifyTree(unittest.TestCase):
+
+             with open(os.path.join(path2,'filename'), 'w'):
+                 pass
++
++            wd = get_wd(i.inotify, path2)
+
+             events = self.__read_all_events(i)
+
+             expected = [
+-                (inotify.adapters._INOTIFY_EVENT(wd=3, mask=256, cookie=0, len=16), ['IN_CREATE'], path2, 'filename'),
+-                (inotify.adapters._INOTIFY_EVENT(wd=3, mask=32, cookie=0, len=16), ['IN_OPEN'], path2, 'filename'),
+-                (inotify.adapters._INOTIFY_EVENT(wd=3, mask=8, cookie=0, len=16), ['IN_CLOSE_WRITE'], path2, 'filename'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd, mask=256, cookie=0, len=16), ['IN_CREATE'], path2, 'filename'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd, mask=32, cookie=0, len=16), ['IN_OPEN'], path2, 'filename'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd, mask=8, cookie=0, len=16), ['IN_CLOSE_WRITE'], path2, 'filename'),
+             ]
+
+-            self.assertEquals(events, expected)
++            if events != expected:
++                print("ACTUAL:")
++                print("")
++
++                for i, event in enumerate(events):
++                    print(event)
++
++                print("")
++
++                print("EXPECTED:")
++                print("")
++
++                for i, event in enumerate(expected):
++                    print(event)
++
++                raise Exception("Events not correct.")
+
+
+ class TestInotifyTrees(unittest.TestCase):
+@@ -428,6 +603,9 @@ class TestInotifyTrees(unittest.TestCase):
+
+             i = inotify.adapters.InotifyTrees([path1, path2])
+
++            wd_path1 = get_wd(i.inotify, path1)
++            wd_path2 = get_wd(i.inotify, path2)
++
+             with open(os.path.join(path1, 'seen_new_file1'), 'w'):
+                 pass
+
+@@ -437,13 +615,13 @@ class TestInotifyTrees(unittest.TestCase):
+             events = self.__read_all_events(i)
+
+             expected = [
+-                (inotify.adapters._INOTIFY_EVENT(wd=1, mask=256, cookie=0, len=16), ['IN_CREATE'], path1, 'seen_new_file1'),
+-                (inotify.adapters._INOTIFY_EVENT(wd=1, mask=32, cookie=0, len=16), ['IN_OPEN'], path1, 'seen_new_file1'),
+-                (inotify.adapters._INOTIFY_EVENT(wd=1, mask=8, cookie=0, len=16), ['IN_CLOSE_WRITE'], path1, 'seen_new_file1'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path1, mask=256, cookie=0, len=16), ['IN_CREATE'], path1, 'seen_new_file1'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path1, mask=32, cookie=0, len=16), ['IN_OPEN'], path1, 'seen_new_file1'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path1, mask=8, cookie=0, len=16), ['IN_CLOSE_WRITE'], path1, 'seen_new_file1'),
+
+-                (inotify.adapters._INOTIFY_EVENT(wd=2, mask=256, cookie=0, len=16), ['IN_CREATE'], path2, 'seen_new_file2'),
+-                (inotify.adapters._INOTIFY_EVENT(wd=2, mask=32, cookie=0, len=16), ['IN_OPEN'], path2, 'seen_new_file2'),
+-                (inotify.adapters._INOTIFY_EVENT(wd=2, mask=8, cookie=0, len=16), ['IN_CLOSE_WRITE'], path2, 'seen_new_file2'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path2, mask=256, cookie=0, len=16), ['IN_CREATE'], path2, 'seen_new_file2'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path2, mask=32, cookie=0, len=16), ['IN_OPEN'], path2, 'seen_new_file2'),
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path2, mask=8, cookie=0, len=16), ['IN_CLOSE_WRITE'], path2, 'seen_new_file2'),
+             ]
+
+-            self.assertEquals(events, expected)
++            self.assertEqual(events, expected)
+--
+2.35.5
+
meta-python/recipes-devtools/python/python3-inotify_git.bb +1 -1
index 15fb92eedd..37a2e2a6f2 100644
@@ -8,6 +8,7 @@ SRC_URI[sha256sum] = "974a623a338482b62e16d4eb705fb863ed33ec178680fc3e96ccdf0df6
 
 SRC_URI = " \
     git://github.com/dsoprea/pyinotify.git;branch=master;protocol=https \
+    file://new-test-inotify.patch \
     file://run-ptest \
 "
 
--

2.25.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#104057): https://lists.openembedded.org/g/openembedded-devel/message/104057
Mute This Topic: https://lists.openembedded.org/mt/100395240/1997914
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#2 lore raw
Quoted 53 lines

-----Original Message-----
From: Khem Raj <[email protected]>
Sent: Thursday, July 27, 2023 10:39 AM
To: Slater, Joseph <[email protected]>
Cc: [email protected]; MacLeod, Randy <[email protected]>
Subject: Re: [oe] [meta-python][PATCH 1/1] python3-inotify: fix tests

Quoted 41 lines · Joe Slater via lists.openembedded.org

From: Joe Slater <[email protected]>

Some tests in test-inotify.py assume values for watch descriptors. This is not safe, so we retrieve the assigned values to compare with event information generated.

---
 .../python3-inotify/new-test-inotify.patch    | 620 ++++++++++++++++++
 .../python/python3-inotify_git.bb             |   1 +
 2 files changed, 621 insertions(+)
 create mode 100644

meta-python/recipes-devtools/python/python3-inotify/new-test-inotify.p atch

diff --git a/meta-python/recipes-devtools/python/python3-inotify/new-test-inotify .patch b/meta-python/recipes-devtools/python/python3-inotify/new-test-inotify .patch
new file mode 100644
index 0000000000..08ef4fd3d6

meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +15 -0
+++ tify.patch
@@ -0,0 +1,620 @@
+From 80010e27d774e8b722d569384492eaab2bc4ac61 Mon Sep 17 00:00:00
+2001
+From: Joe Slater <[email protected]>
+Date: Thu, 27 Jul 2023 15:01:04 +0000
+Subject: [PATCH] working commit
+
+It is not safe to assume the values returned by add_watch(), so we
+add a local helper get_wd() to retrieve them.  This fixes a problem
+in TestInotifyTree.test__cycle() where the wd's for the 'aa' and 'bb'
+paths are not '2' and '3', respectively.
+
+A second issue is that Inotify._get_event_names() should return a set
+or sorted list to avoid comparison problems, but that is not
+addressed here since it could be viewed as changing the API.
Quoted 8 lines

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 19

Quoted 5 lines
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +5 -0
+
+This test_inotify.py is based on the version in the fix_tests branch
+of pyinotify as of commit d7d3c58...
+
+Upstream-Status: Submitted [to maintainer [email protected]]

hmmm, why not create a github PR at
https://github.com/dsoprea/pyinotify

[Slater, Joseph]
No reason other than since I'm thinking this is a one-off it was easier to do

clone, format-patch

rather than

fork, clone, push, pull

but I haven't kept up with github options, so maybe generating a PR can be done without a fork.

Joe

Quoted 779 lines
Quoted 23 lines
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +22 -0
+
+Signed-off-by: Joe Slater <[email protected]>
+---
+ tests/test_inotify.py | 346
+++++++++++++++++++++++++++++++++----------
+ 1 file changed, 262 insertions(+), 84 deletions(-)
+
+diff --git a/tests/test_inotify.py b/tests/test_inotify.py index
+d9f1f84..d89a49e 100644
+--- a/tests/test_inotify.py
++++ b/tests/test_inotify.py
+@@ -2,6 +2,7 @@
+
+ import os
+ import unittest
++import time
+
+ import inotify.constants
+ import inotify.calls
+@@ -15,6 +16,11 @@ except NameError:
+ else:
+     _HAS_PYTHON2_UNICODE_SUPPORT = True

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 51

Quoted 10 lines
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +10 -0
+
++# Inotify does not have a get for watch descriptors # def get_wd(i,
++path):
++    return i._Inotify__watches[path]
++
+
+ class TestInotify(unittest.TestCase):
+     def __init__(self, *args, **kwargs):
+@@ -29,11 +35,11 @@ class TestInotify(unittest.TestCase):
+     @unittest.skipIf(_HAS_PYTHON2_UNICODE_SUPPORT is True, "Not in

Python 3")

Quoted 7 lines
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +7 -0
+     def test__international_naming_python3(self):
+         with inotify.test_support.temp_path() as path:
+-            inner_path = os.path.join(path, '新增資料夾')
++            inner_path = os.path.join(path, u'新增資料夾')
+             os.mkdir(inner_path)
+
+             i = inotify.adapters.Inotify()

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 68

Quoted 10 lines
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +10 -0
+-            i.add_watch(inner_path)
++            wd = i.add_watch(inner_path)
+
+             with open(os.path.join(inner_path, 'filename'), 'w'):
+                 pass
+@@ -41,12 +47,27 @@ class TestInotify(unittest.TestCase):
+             events = self.__read_all_events(i)
+
+             expected = [
+-                (inotify.adapters._INOTIFY_EVENT(wd=1, mask=256, cookie=0,

len=16), ['IN_CREATE'], inner_path, 'filename'),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 69

Quoted 1 line
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +1 -0
+-                (inotify.adapters._INOTIFY_EVENT(wd=1, mask=32, cookie=0,

len=16), ['IN_OPEN'], inner_path, 'filename'),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 70

Quoted 1 line
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +1 -0
+-                (inotify.adapters._INOTIFY_EVENT(wd=1, mask=8, cookie=0,

len=16), ['IN_CLOSE_WRITE'], inner_path, 'filename'),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 71

Quoted 1 line
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +1 -0
++                (inotify.adapters._INOTIFY_EVENT(wd=wd, mask=256, cookie=0,

len=16), ['IN_CREATE'], inner_path, 'filename'),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 72

Quoted 1 line
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +1 -0
++                (inotify.adapters._INOTIFY_EVENT(wd=wd, mask=32, cookie=0,

len=16), ['IN_OPEN'], inner_path, 'filename'),

Quoted 13 lines
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +13 -0
++                (inotify.adapters._INOTIFY_EVENT(wd=wd, mask=8,
++ cookie=0, len=16), ['IN_CLOSE_WRITE'], inner_path, 'filename'),
+             ]
+
+-            self.assertEquals(events, expected)
++            if events != expected:
++                print("ACTUAL:")
++                print("")
++
++                for i, event in enumerate(events):
++                    print(event)
++
++                print("")

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 95

Quoted 10 lines
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +10 -0
++
++                print("EXPECTED:")
++                print("")
++
++                for i, event in enumerate(expected):
++                    print(event)
++
++                raise Exception("Events not correct.")
+
+     @unittest.skipIf(_HAS_PYTHON2_UNICODE_SUPPORT is False, "Not in

Python 2")

Quoted 5 lines
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +5 -0
+     def test__international_naming_python2(self):
+@@ -55,7 +76,7 @@ class TestInotify(unittest.TestCase):
+             os.mkdir(inner_path)
+
+             i = inotify.adapters.Inotify()

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 110

Quoted 10 lines
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +10 -0
+-            i.add_watch(inner_path)
++            wd = i.add_watch(inner_path)
+
+             with open(os.path.join(inner_path, u'filename料夾'), 'w'):
+                 pass
+@@ -63,12 +84,28 @@ class TestInotify(unittest.TestCase):
+             events = self.__read_all_events(i)
+
+             expected = [
+-                (inotify.adapters._INOTIFY_EVENT(wd=1, mask=256, cookie=0,

len=16), ['IN_CREATE'], inner_path, u'filename料夾'),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 111

Quoted 1 line
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +1 -0
+-                (inotify.adapters._INOTIFY_EVENT(wd=1, mask=32, cookie=0,

len=16), ['IN_OPEN'], inner_path, u'filename料夾'),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 112

Quoted 1 line
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +1 -0
+-                (inotify.adapters._INOTIFY_EVENT(wd=1, mask=8, cookie=0,

len=16), ['IN_CLOSE_WRITE'], inner_path, u'filename料夾'),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 113

Quoted 1 line
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +1 -0
++                (inotify.adapters._INOTIFY_EVENT(wd=wd, mask=256, cookie=0,

len=16), ['IN_CREATE'], inner_path, u'filename料夾'),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 114

Quoted 1 line
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +1 -0
++                (inotify.adapters._INOTIFY_EVENT(wd=wd, mask=32, cookie=0,

len=16), ['IN_OPEN'], inner_path, u'filename料夾'),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 115

Quoted 1 line
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +1 -0
++                (inotify.adapters._INOTIFY_EVENT(wd=wd, mask=8, cookie=0,

len=16), ['IN_CLOSE_WRITE'], inner_path, u'filename料夾'),

Quoted 29 lines
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +29 -0
++                (inotify.adapters._INOTIFY_EVENT(wd=wd, mask=16,
++ cookie=0, len=16), ['IN_CLOSE_NOWRITE'], inner_path,
++ u'filename料夾'),
+             ]
+
+-            self.assertEquals(events, expected)
++            if events != expected:
++                print("ACTUAL:")
++                print("")
++
++                for i, event in enumerate(events):
++                    print(event)
++
++                print("")
++
++                print("EXPECTED:")
++                print("")
++
++                for i, event in enumerate(expected):
++                    print(event)
++
++                raise Exception("Events not correct.")
+
+     def test__cycle(self):
+         with inotify.test_support.temp_path() as path:
+@@ -79,7 +116,7 @@ class TestInotify(unittest.TestCase):
+             os.mkdir(path2)
+
+             i = inotify.adapters.Inotify()

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 154

Quoted 10 lines
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +10 -0
+-            i.add_watch(path1)
++            wd = i.add_watch(path1)
+
+             with open('ignored_new_file', 'w'):
+                 pass
+@@ -96,32 +133,47 @@ class TestInotify(unittest.TestCase):
+
+             expected = [
+                 (
+-                    inotify.adapters._INOTIFY_EVENT(wd=1, mask=256, cookie=0,

len=16),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 162

Quoted 8 lines
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +8 -0
++                    inotify.adapters._INOTIFY_EVENT(wd=wd, mask=256,
++ cookie=0, len=16),
+                     ['IN_CREATE'],
+                     path1,
+                     'seen_new_file'
+                 ),
+                 (
+-                    inotify.adapters._INOTIFY_EVENT(wd=1, mask=32, cookie=0,

len=16),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 170

Quoted 8 lines
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +8 -0
++                    inotify.adapters._INOTIFY_EVENT(wd=wd, mask=32,
++ cookie=0, len=16),
+                     ['IN_OPEN'],
+                     path1,
+                     'seen_new_file'
+                 ),
+                 (
+-                    inotify.adapters._INOTIFY_EVENT(wd=1, mask=8, cookie=0,

len=16),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 178

Quoted 8 lines
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +8 -0
++                    inotify.adapters._INOTIFY_EVENT(wd=wd, mask=8,
++ cookie=0, len=16),
+                     ['IN_CLOSE_WRITE'],
+                     path1,
+                     'seen_new_file'
+                 ),
+                 (
+-                    inotify.adapters._INOTIFY_EVENT(wd=1, mask=512, cookie=0,

len=16),

Quoted 48 lines
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +48 -0
++                    inotify.adapters._INOTIFY_EVENT(wd=wd, mask=512,
++ cookie=0, len=16),
+                     ['IN_DELETE'],
+                     path1,
+                     'seen_new_file'
+                 )
+             ]
+
+-            self.assertEquals(events, expected)
++            if events != expected:
++                print("ACTUAL:")
++                print("")
++
++                for i, event in enumerate(events):
++                    print(event)
++
++                print("")
++
++                print("EXPECTED:")
++                print("")
++
++                for i, event in enumerate(expected):
++                    print(event)
++
++                raise Exception("Events not correct.")
+
+             # This can't be removed until *after* we've read the events because
+             # they'll be flushed the moment we remove the watch.
+@@ -131,7 +183,7 @@ class TestInotify(unittest.TestCase):
+                 pass
+
+             events = self.__read_all_events(i)
+-            self.assertEquals(events, [])
++            self.assertEqual(events, [])
+
+     @staticmethod
+     def _open_write_close(*args):
+@@ -167,23 +219,47 @@ class TestInotify(unittest.TestCase):
+         with inotify.test_support.temp_path() as path:
+             path1 = TestInotify._make_temp_path(path, 'aa')
+             path2 = TestInotify._make_temp_path(path, 'bb')
++
+             i = inotify.adapters.Inotify([path1, path2])
++
+             TestInotify._open_write_close('ignored_new_file')
+             TestInotify._open_write_close(path1, 'seen_new_file')
+             TestInotify._open_write_close(path2, 'seen_new_file2')
++

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 236

Quoted 10 lines
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +10 -0
++            wd_path1 = get_wd(i, path1)
++            wd_path2 = get_wd(i, path2)
++
++
+             os.remove(os.path.join(path1, 'seen_new_file'))
++
+             events = self.__read_all_events(i)
++
+             expected = [
+-                TestInotify._event_create(wd=1, path=path1,

filename='seen_new_file'),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 237

Quoted 1 line
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +1 -0
+-                TestInotify._event_open(wd=1, path=path1,

filename='seen_new_file'),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 238

Quoted 1 line
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +1 -0
+-                TestInotify._event_close_write(wd=1, path=path1,

filename='seen_new_file'),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 239

Quoted 1 line
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +1 -0
+-                TestInotify._event_create(wd=2, path=path2,

filename='seen_new_file2'),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 240

Quoted 1 line
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +1 -0
+-                TestInotify._event_open(wd=2, path=path2,

filename='seen_new_file2'),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 241

Quoted 1 line
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +1 -0
+-                TestInotify._event_close_write(wd=2, path=path2,

filename='seen_new_file2'),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 242

Quoted 1 line
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +1 -0
+-                TestInotify._event_general(wd=1, mask=512,

type_name='IN_DELETE',

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 244

Quoted 2 lines
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +2 -0
+-                                           path=path1, filename='seen_new_file')
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path1, mask=256,

cookie=0, len=16), ['IN_CREATE'], path1, u'seen_new_file'),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 245

Quoted 1 line
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +1 -0
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path1, mask=32,

cookie=0, len=16), ['IN_OPEN'], path1, u'seen_new_file'),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 246

Quoted 1 line
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +1 -0
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path1, mask=8,

cookie=0, len=16), ['IN_CLOSE_WRITE'], path1, u'seen_new_file'),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 247

Quoted 1 line
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +1 -0
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path2, mask=256,

cookie=0, len=16), ['IN_CREATE'], path2, u'seen_new_file2'),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 248

Quoted 1 line
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +1 -0
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path2, mask=32,

cookie=0, len=16), ['IN_OPEN'], path2, u'seen_new_file2'),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 249

Quoted 1 line
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +1 -0
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path2, mask=8,

cookie=0, len=16), ['IN_CLOSE_WRITE'], path2, u'seen_new_file2'),

Quoted 82 lines
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +82 -0
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path1,
++ mask=512, cookie=0, len=16), ['IN_DELETE'], path1,
++ u'seen_new_file'),
+             ]
+-            self.assertEquals(events, expected)
++
++            if events != expected:
++                print("ACTUAL:")
++                print("")
++
++                for i, event in enumerate(events):
++                    print(event)
++
++                print("")
++
++                print("EXPECTED:")
++                print("")
++
++                for i, event in enumerate(expected):
++                    print(event)
++
++                raise Exception("Events not correct.")
+
+     def test__error_on_watch_nonexistent_folder(self):
+         i = inotify.adapters.Inotify() @@ -201,7 +277,7 @@ class
+TestInotify(unittest.TestCase):
+         i = inotify.adapters.Inotify()
+         names = i._get_event_names(all_mask)
+
+-        self.assertEquals(names, all_names)
++        self.assertEqual(names, all_names)
+
+
+ class TestInotifyTree(unittest.TestCase):
+@@ -219,56 +295,101 @@ class TestInotifyTree(unittest.TestCase):
+             path1 = os.path.join(path, 'aa')
+             os.mkdir(path1)
+
++            time.sleep(.10)
++
+             path2 = os.path.join(path, 'bb')
+             os.mkdir(path2)
+
++            time.sleep(.10)
++
+             i = inotify.adapters.InotifyTree(path)
+
+             with open('seen_new_file1', 'w'):
+                 pass
+
++            time.sleep(.10)
++
+             with open(os.path.join(path1, 'seen_new_file2'), 'w'):
+                 pass
+
++            time.sleep(.10)
++
+             with open(os.path.join(path2, 'seen_new_file3'), 'w'):
+                 pass
+
++            time.sleep(.10)
++
++            wd_path  = get_wd(i.inotify, path)
++            wd_path1 = get_wd(i.inotify, path1)
++            wd_path2 = get_wd(i.inotify, path2)
++
+             os.remove(os.path.join(path, 'seen_new_file1'))
++
++            time.sleep(.10)
++
+             os.remove(os.path.join(path1, 'seen_new_file2'))
++
++            time.sleep(.10)
++
+             os.remove(os.path.join(path2, 'seen_new_file3'))
+
++            time.sleep(.10)
++
+             os.rmdir(path1)
++
++            time.sleep(.10)
++

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 341

Quoted 10 lines
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +10 -0
+             os.rmdir(path2)
+
+-            events = self.__read_all_events(i)
++            time.sleep(.10)
+
++            events = self.__read_all_events(i)
++            events = sorted(events)
++
+             expected = [
+-                (inotify.adapters._INOTIFY_EVENT(wd=1, mask=256, cookie=0,

len=16), ['IN_CREATE'], path, 'seen_new_file1'),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 342

Quoted 1 line
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +1 -0
+-                (inotify.adapters._INOTIFY_EVENT(wd=1, mask=32, cookie=0,

len=16), ['IN_OPEN'], path, 'seen_new_file1'),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 343

Quoted 1 line
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +1 -0
+-                (inotify.adapters._INOTIFY_EVENT(wd=1, mask=8, cookie=0,

len=16), ['IN_CLOSE_WRITE'], path, 'seen_new_file1'),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 344

Quoted 1 line
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +1 -0
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path, mask=256,

cookie=0, len=16), ['IN_CREATE'], path, 'seen_new_file1'),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 345

Quoted 1 line
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +1 -0
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path, mask=32,

cookie=0, len=16), ['IN_OPEN'], path, 'seen_new_file1'),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 349

Quoted 4 lines
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +4 -0
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path, mask=8,
++ cookie=0, len=16), ['IN_CLOSE_WRITE'], path, 'seen_new_file1'),
+
+-                (inotify.adapters._INOTIFY_EVENT(wd=2, mask=256, cookie=0,

len=16), ['IN_CREATE'], path1, 'seen_new_file2'),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 350

Quoted 1 line
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +1 -0
+-                (inotify.adapters._INOTIFY_EVENT(wd=2, mask=32, cookie=0,

len=16), ['IN_OPEN'], path1, 'seen_new_file2'),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 351

Quoted 1 line
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +1 -0
+-                (inotify.adapters._INOTIFY_EVENT(wd=2, mask=8, cookie=0,

len=16), ['IN_CLOSE_WRITE'], path1, 'seen_new_file2'),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 352

Quoted 1 line
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +1 -0
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path1, mask=256,

cookie=0, len=16), ['IN_CREATE'], path1, 'seen_new_file2'),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 353

Quoted 1 line
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +1 -0
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path1, mask=32,

cookie=0, len=16), ['IN_OPEN'], path1, 'seen_new_file2'),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 358

Quoted 5 lines
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +5 -0
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path1,
++ mask=8, cookie=0, len=16), ['IN_CLOSE_WRITE'], path1,
++ 'seen_new_file2'),
+
+-                (inotify.adapters._INOTIFY_EVENT(wd=3, mask=256, cookie=0,

len=16), ['IN_CREATE'], path2, 'seen_new_file3'),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 359

Quoted 1 line
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +1 -0
+-                (inotify.adapters._INOTIFY_EVENT(wd=3, mask=32, cookie=0,

len=16), ['IN_OPEN'], path2, 'seen_new_file3'),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 360

Quoted 1 line
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +1 -0
+-                (inotify.adapters._INOTIFY_EVENT(wd=3, mask=8, cookie=0,

len=16), ['IN_CLOSE_WRITE'], path2, 'seen_new_file3'),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 361

Quoted 1 line
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +1 -0
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path2, mask=256,

cookie=0, len=16), ['IN_CREATE'], path2, 'seen_new_file3'),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 362

Quoted 1 line
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +1 -0
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path2, mask=32,

cookie=0, len=16), ['IN_OPEN'], path2, 'seen_new_file3'),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 367

Quoted 5 lines
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +5 -0
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path2,
++ mask=8, cookie=0, len=16), ['IN_CLOSE_WRITE'], path2,
++ 'seen_new_file3'),
+
+-                (inotify.adapters._INOTIFY_EVENT(wd=1, mask=512, cookie=0,

len=16), ['IN_DELETE'], path, 'seen_new_file1'),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 368

Quoted 1 line
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +1 -0
+-                (inotify.adapters._INOTIFY_EVENT(wd=2, mask=512, cookie=0,

len=16), ['IN_DELETE'], path1, 'seen_new_file2'),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 369

Quoted 1 line
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +1 -0
+-                (inotify.adapters._INOTIFY_EVENT(wd=3, mask=512, cookie=0,

len=16), ['IN_DELETE'], path2, 'seen_new_file3'),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 370

Quoted 1 line
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +1 -0
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path, mask=512,

cookie=0, len=16), ['IN_DELETE'], path, 'seen_new_file1'),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 371

Quoted 1 line
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +1 -0
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path1, mask=512,

cookie=0, len=16), ['IN_DELETE'], path1, 'seen_new_file2'),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 376

Quoted 5 lines
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +5 -0
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path2,
++ mask=512, cookie=0, len=16), ['IN_DELETE'], path2,
++ 'seen_new_file3'),
+
+-                (inotify.adapters._INOTIFY_EVENT(wd=2, mask=1024, cookie=0,

len=0), ['IN_DELETE_SELF'], path1, ''),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 377

Quoted 1 line
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +1 -0
+-                (inotify.adapters._INOTIFY_EVENT(wd=2, mask=32768, cookie=0,

len=0), ['IN_IGNORED'], path1, ''),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 378

Quoted 1 line
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +1 -0
+-                (inotify.adapters._INOTIFY_EVENT(wd=1, mask=1073742336,

cookie=0, len=16), ['IN_ISDIR', 'IN_DELETE'], path, 'aa'),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 379

Quoted 1 line
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +1 -0
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path1, mask=1024,

cookie=0, len=0), ['IN_DELETE_SELF'], path1, ''),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 380

Quoted 1 line
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +1 -0
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path1, mask=32768,

cookie=0, len=0), ['IN_IGNORED'], path1, ''),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 385

Quoted 5 lines
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +5 -0
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path,
++ mask=1073742336, cookie=0, len=16), ['IN_DELETE', 'IN_ISDIR'],
++ path, 'aa'),
+
+-                (inotify.adapters._INOTIFY_EVENT(wd=3, mask=1024, cookie=0,

len=0), ['IN_DELETE_SELF'], path2, ''),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 386

Quoted 1 line
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +1 -0
+-                (inotify.adapters._INOTIFY_EVENT(wd=3, mask=32768, cookie=0,

len=0), ['IN_IGNORED'], path2, ''),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 387

Quoted 1 line
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +1 -0
+-                (inotify.adapters._INOTIFY_EVENT(wd=1, mask=1073742336,

cookie=0, len=16), ['IN_ISDIR', 'IN_DELETE'], path, 'bb'),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 388

Quoted 1 line
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +1 -0
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path2, mask=1024,

cookie=0, len=0), ['IN_DELETE_SELF'], path2, ''),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 389

Quoted 1 line
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +1 -0
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path2, mask=32768,

cookie=0, len=0), ['IN_IGNORED'], path2, ''),

Quoted 28 lines
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +28 -0
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path,
++ mask=1073742336, cookie=0, len=16), ['IN_DELETE', 'IN_ISDIR'],
++ path, 'bb'),
+             ]
+
+-            self.assertEquals(events, expected)
++            expected = sorted(expected)
++
++            if events != expected:
++                print("ACTUAL:")
++                print("")
++
++                for i, event in enumerate(events):
++                    print(event)
++
++                print("")
++
++                print("EXPECTED:")
++                print("")
++
++                for i, event in enumerate(expected):
++                    print(event)
++
++                raise Exception("Events not correct.")
+
+     def test__renames(self):
+
+@@ -283,26 +404,30 @@ class TestInotifyTree(unittest.TestCase):

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 427

Quoted 10 lines
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +10 -0
+             new_path = os.path.join(path, 'new_folder')
+
+             os.mkdir(old_path)
++
++            wd_path = get_wd(i.inotify, path)
+
+             events1 = self.__read_all_events(i)
+
+             expected = [
+-                (inotify.adapters._INOTIFY_EVENT(wd=1, mask=1073742080,

cookie=events1[0][0].cookie, len=16), ['IN_ISDIR', 'IN_CREATE'], path, 'old_folder'),

Quoted 7 lines
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +7 -0
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path,
++ mask=1073742080, cookie=events1[0][0].cookie, len=16),
++ ['IN_CREATE', 'IN_ISDIR'], path, 'old_folder'),
+             ]
+
+-            self.assertEquals(events1, expected)
+-

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 444

Quoted 10 lines
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +10 -0
++            self.assertEqual(events1, expected)
+
+             os.rename(old_path, new_path)
+
++            wd_old_path = get_wd(i.inotify, old_path)
++
+             events2 = self.__read_all_events(i)
+
+             expected = [
+-                (inotify.adapters._INOTIFY_EVENT(wd=1, mask=1073741888,

cookie=events2[0][0].cookie, len=16), ['IN_MOVED_FROM', 'IN_ISDIR'], path, 'old_folder'),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 445

Quoted 1 line
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +1 -0
+-                (inotify.adapters._INOTIFY_EVENT(wd=1, mask=1073741952,

cookie=events2[1][0].cookie, len=16), ['IN_MOVED_TO', 'IN_ISDIR'], path, 'new_folder'),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 446

Quoted 1 line
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +1 -0
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path,

mask=1073741888, cookie=events2[0][0].cookie, len=16), ['IN_MOVED_FROM', 'IN_ISDIR'], path, 'old_folder'),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 447

Quoted 1 line
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +1 -0
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path,

mask=1073741952, cookie=events2[1][0].cookie, len=16), ['IN_MOVED_TO', 'IN_ISDIR'], path, 'new_folder'),

Quoted 4 lines
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +4 -0
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_old_path,
++ mask=2048, cookie=0, len=0), ['IN_MOVE_SELF'], new_path, '')
+             ]
+

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 461

Quoted 10 lines
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +10 -0
+-            self.assertEquals(events2, expected)
++            self.assertEqual(events2, expected)
+
+
+             with open(os.path.join(new_path, 'old_filename'), 'w'):
+@@ -318,21 +443,33 @@ class TestInotifyTree(unittest.TestCase):
+             events3 = self.__read_all_events(i)
+
+             expected = [
+-                (inotify.adapters._INOTIFY_EVENT(wd=3, mask=256, cookie=0,

len=16), ['IN_CREATE'], new_path, 'old_filename'),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 462

Quoted 1 line
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +1 -0
+-                (inotify.adapters._INOTIFY_EVENT(wd=3, mask=32, cookie=0,

len=16), ['IN_OPEN'], new_path, 'old_filename'),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 463

Quoted 1 line
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +1 -0
+-                (inotify.adapters._INOTIFY_EVENT(wd=3, mask=8, cookie=0,

len=16), ['IN_CLOSE_WRITE'], new_path, 'old_filename'),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 464

Quoted 1 line
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +1 -0
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_old_path, mask=256,

cookie=0, len=16), ['IN_CREATE'], new_path, 'old_filename'),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 465

Quoted 1 line
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +1 -0
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_old_path, mask=32,

cookie=0, len=16), ['IN_OPEN'], new_path, 'old_filename'),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 466

Quoted 1 line
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +1 -0
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_old_path, mask=8,

cookie=0, len=16), ['IN_CLOSE_WRITE'], new_path, 'old_filename'),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 467

Quoted 1 line
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +1 -0
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_old_path, mask=64,

cookie=events3[3][0].cookie, len=16), ['IN_MOVED_FROM'], new_path, 'old_filename'),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 468

Quoted 1 line
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +1 -0
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_old_path, mask=128,

cookie=events3[4][0].cookie, len=16), ['IN_MOVED_TO'], new_path, 'new_filename'),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 469

Quoted 1 line
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +1 -0
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_old_path, mask=512,

cookie=0, len=16), ['IN_DELETE'], new_path, 'new_filename'),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 470

Quoted 1 line
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +1 -0
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_old_path, mask=1024,

cookie=0, len=0), ['IN_DELETE_SELF'], new_path, ''),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 471

Quoted 1 line
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +1 -0
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_old_path, mask=32768,

cookie=0, len=0), ['IN_IGNORED'], new_path, ''),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 472

Quoted 1 line
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +1 -0
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path,

mask=1073742336, cookie=0, len=16), ['IN_DELETE', 'IN_ISDIR'], path, 'new_folder'),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 475

Quoted 3 lines
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +3 -0
++            ]
+
+-                (inotify.adapters._INOTIFY_EVENT(wd=3, mask=64,

cookie=events3[3][0].cookie, len=16), ['IN_MOVED_FROM'], new_path, 'old_filename'),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 476

Quoted 1 line
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +1 -0
+-                (inotify.adapters._INOTIFY_EVENT(wd=3, mask=128,

cookie=events3[4][0].cookie, len=16), ['IN_MOVED_TO'], new_path, 'new_filename'),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 481

Quoted 5 lines
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +5 -0
++            if events3 != expected:
++                print("ACTUAL:")
++                print("")
+
+-                (inotify.adapters._INOTIFY_EVENT(wd=3, mask=512, cookie=0,

len=16), ['IN_DELETE'], new_path, 'new_filename'),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 485

Quoted 4 lines
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +4 -0
++                for i, event in enumerate(events3):
++                    print(event)
+
+-                (inotify.adapters._INOTIFY_EVENT(wd=3, mask=1024, cookie=0,

len=0), ['IN_DELETE_SELF'], new_path, ''),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 486

Quoted 1 line
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +1 -0
+-                (inotify.adapters._INOTIFY_EVENT(wd=3, mask=32768, cookie=0,

len=0), ['IN_IGNORED'], new_path, ''),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 487

Quoted 1 line
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +1 -0
+-                (inotify.adapters._INOTIFY_EVENT(wd=1, mask=1073742336,

cookie=0, len=16), ['IN_ISDIR', 'IN_DELETE'], path, 'new_folder'),

Quoted 15 lines
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +15 -0
+-            ]
++                print("")
++
++                print("EXPECTED:")
++                print("")
+
+-            self.assertEquals(events3, expected)
++                for i, event in enumerate(expected):
++                    print(event)
++
++                raise Exception("Events not correct.")
+
+     def test__automatic_new_watches_on_new_paths(self):
+
+@@ -346,39 +483,60 @@ class TestInotifyTree(unittest.TestCase):

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 512

Quoted 10 lines
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +10 -0
+             path2 = os.path.join(path1, 'folder2')
+
+             os.mkdir(path1)
++
++            wd_path = get_wd(i.inotify, path)
+
+             events = self.__read_all_events(i)
+
+             expected = [
+-                (inotify.adapters._INOTIFY_EVENT(wd=1, mask=1073742080,

cookie=0, len=16), ['IN_ISDIR', 'IN_CREATE'], path, 'folder1'),

Quoted 7 lines
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +7 -0
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path,
++ mask=1073742080, cookie=0, len=16), ['IN_CREATE', 'IN_ISDIR'],
++ path, 'folder1'),
+             ]
+
+-            self.assertEquals(events, expected)
++            self.assertEqual(events, expected)

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 529

Quoted 10 lines
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +10 -0
+
+
+             os.mkdir(path2)
+
++            wd_path1 = get_wd(i.inotify, path1)
++
+             events = self.__read_all_events(i)
+
+             expected = [
+-                (inotify.adapters._INOTIFY_EVENT(wd=2, mask=1073742080,

cookie=0, len=16), ['IN_ISDIR', 'IN_CREATE'], path1, 'folder2'),

Quoted 8 lines
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +8 -0
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path1,
++ mask=1073742080, cookie=0, len=16), ['IN_CREATE', 'IN_ISDIR'],
++ path1, 'folder2'),
+             ]
+
+-            self.assertEquals(events, expected)
++            self.assertEqual(events, expected)
+

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 547

Quoted 10 lines
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +10 -0
+
+             with open(os.path.join(path2,'filename'), 'w'):
+                 pass
+
++            wd_path2 = get_wd(i.inotify, path2)
++
+             events = self.__read_all_events(i)
+
+             expected = [
+-                (inotify.adapters._INOTIFY_EVENT(wd=3, mask=256, cookie=0,

len=16), ['IN_CREATE'], path2, 'filename'),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 548

Quoted 1 line
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +1 -0
+-                (inotify.adapters._INOTIFY_EVENT(wd=3, mask=32, cookie=0,

len=16), ['IN_OPEN'], path2, 'filename'),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 549

Quoted 1 line
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +1 -0
+-                (inotify.adapters._INOTIFY_EVENT(wd=3, mask=8, cookie=0,

len=16), ['IN_CLOSE_WRITE'], path2, 'filename'),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 550

Quoted 1 line
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +1 -0
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path2, mask=256,

cookie=0, len=16), ['IN_CREATE'], path2, 'filename'),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 551

Quoted 1 line
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +1 -0
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path2, mask=32,

cookie=0, len=16), ['IN_OPEN'], path2, 'filename'),

Quoted 25 lines
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +25 -0
++                (inotify.adapters._INOTIFY_EVENT(wd=wd_path2,
++ mask=8, cookie=0, len=16), ['IN_CLOSE_WRITE'], path2, 'filename'),
+             ]
+
+-            self.assertEquals(events, expected)
++            if events != expected:
++                print("ACTUAL:")
++                print("")
++
++                for i, event in enumerate(events):
++                    print(event)
++
++                print("")
++
++                print("EXPECTED:")
++                print("")
++
++                for i, event in enumerate(expected):
++                    print(event)
++
++                raise Exception("Events not correct.")
+
+     def test__automatic_new_watches_on_existing_paths(self):
+
+@@ -396,16 +554,33 @@ class TestInotifyTree(unittest.TestCase):

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 586

Quoted 10 lines
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +10 -0
+
+             with open(os.path.join(path2,'filename'), 'w'):
+                 pass
++
++            wd = get_wd(i.inotify, path2)
+
+             events = self.__read_all_events(i)
+
+             expected = [
+-                (inotify.adapters._INOTIFY_EVENT(wd=3, mask=256, cookie=0,

len=16), ['IN_CREATE'], path2, 'filename'),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 587

Quoted 1 line
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +1 -0
+-                (inotify.adapters._INOTIFY_EVENT(wd=3, mask=32, cookie=0,

len=16), ['IN_OPEN'], path2, 'filename'),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 588

Quoted 1 line
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +1 -0
+-                (inotify.adapters._INOTIFY_EVENT(wd=3, mask=8, cookie=0,

len=16), ['IN_CLOSE_WRITE'], path2, 'filename'),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 589

Quoted 1 line
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +1 -0
++                (inotify.adapters._INOTIFY_EVENT(wd=wd, mask=256, cookie=0,

len=16), ['IN_CREATE'], path2, 'filename'),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino line 590

Quoted 1 line
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +1 -0
++                (inotify.adapters._INOTIFY_EVENT(wd=wd, mask=32, cookie=0,

len=16), ['IN_OPEN'], path2, 'filename'),

Quoted 29 lines
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +29 -0
++                (inotify.adapters._INOTIFY_EVENT(wd=wd, mask=8,
++ cookie=0, len=16), ['IN_CLOSE_WRITE'], path2, 'filename'),
+             ]
+
+-            self.assertEquals(events, expected)
++            if events != expected:
++                print("ACTUAL:")
++                print("")
++
++                for i, event in enumerate(events):
++                    print(event)
++
++                print("")
++
++                print("EXPECTED:")
++                print("")
++
++                for i, event in enumerate(expected):
++                    print(event)
++
++                raise Exception("Events not correct.")
+
+
+ class TestInotifyTrees(unittest.TestCase):
+@@ -428,6 +603,9 @@ class TestInotifyTrees(unittest.TestCase):
+
+             i = inotify.adapters.InotifyTrees([path1, path2])
+
++            wd_path1 = get_wd(i.inotify, path1)

meta-python/recipes-devtools/python/python3-inotify/new-test-ino

Quoted 10 lines
meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +10 -0
++            wd_path2 = get_wd(i.inotify, path2)
++
+             with open(os.path.join(path1, 'seen_new_file1'), 'w'):
+                 pass
+
+@@ -437,13 +615,13 @@ class TestInotifyTrees(unittest.TestCase):
+             events = self.__read_all_events(i)
+
+             expected = [
+-                (inotify.adapters._INOTIFY_EVENT(wd=1, mask=256, cookie=0,

len=16), ['IN_CREATE'], path1, 'seen_new_file1'),

Quoted 1 line

+- (inotify.adapters._INOTIFY_EVENT(wd=1, mask=32, cookie=0,

len=16), ['IN_OPEN'], path1, 'seen_new_file1'),

Quoted 1 line

+- (inotify.adapters._INOTIFY_EVENT(wd=1, mask=8, cookie=0,

len=16), ['IN_CLOSE_WRITE'], path1, 'seen_new_file1'),

Quoted 1 line

++ (inotify.adapters._INOTIFY_EVENT(wd=wd_path1, mask=256,

cookie=0, len=16), ['IN_CREATE'], path1, 'seen_new_file1'),

Quoted 1 line

++ (inotify.adapters._INOTIFY_EVENT(wd=wd_path1, mask=32,

cookie=0, len=16), ['IN_OPEN'], path1, 'seen_new_file1'),

Quoted 5 lines

++ (inotify.adapters._INOTIFY_EVENT(wd=wd_path1,
++ mask=8, cookie=0, len=16), ['IN_CLOSE_WRITE'], path1, ++ 'seen_new_file1'),
+
+- (inotify.adapters._INOTIFY_EVENT(wd=2, mask=256, cookie=0,

len=16), ['IN_CREATE'], path2, 'seen_new_file2'),

Quoted 1 line

+- (inotify.adapters._INOTIFY_EVENT(wd=2, mask=32, cookie=0,

len=16), ['IN_OPEN'], path2, 'seen_new_file2'),

Quoted 1 line

+- (inotify.adapters._INOTIFY_EVENT(wd=2, mask=8, cookie=0,

len=16), ['IN_CLOSE_WRITE'], path2, 'seen_new_file2'),

Quoted 1 line

++ (inotify.adapters._INOTIFY_EVENT(wd=wd_path2, mask=256,

cookie=0, len=16), ['IN_CREATE'], path2, 'seen_new_file2'),

Quoted 1 line

++ (inotify.adapters._INOTIFY_EVENT(wd=wd_path2, mask=32,

cookie=0, len=16), ['IN_OPEN'], path2, 'seen_new_file2'),

Quoted 40 lines

++ (inotify.adapters._INOTIFY_EVENT(wd=wd_path2,
++ mask=8, cookie=0, len=16), ['IN_CLOSE_WRITE'], path2, ++ 'seen_new_file2'),

meta-python/recipes-devtools/python/python3-inotify/new-test-ino new file +7 -0
+             ]
+
+-            self.assertEquals(events, expected)
++            self.assertEqual(events, expected)
+--
+2.35.5
+

diff --git a/meta-python/recipes-devtools/python/python3-inotify_git.bb b/meta-python/recipes-devtools/python/python3-inotify_git.bb index 15fb92eedd..37a2e2a6f2 100644

meta-python/recipes-devtools/python/python3-inotify_git.bb +0 -0
@@ -8,6 +8,7 @@ SRC_URI[sha256sum] =

"974a623a338482b62e16d4eb705fb863ed33ec178680fc3e96ccdf0df6

SRC_URI = " \

git://github.com/dsoprea/pyinotify.git;branch=master;protocol=https \

+    file://new-test-inotify.patch \
     file://run-ptest \

"

--
2.25.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#104057):
https://lists.openembedded.org/g/openembedded-devel/message/104057
Mute This Topic: https://lists.openembedded.org/mt/100395240/1997914
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-