-
Notifications
You must be signed in to change notification settings - Fork 90
Fix recursive directory navigation #164
Conversation
Since event.name of inotify just returns the folder name if a new folder is created, the directory structure wasn't being walked properly. This change fixes the bug to enable correct traversal of the directory.
add_watch return types are always int starting from 1 - https://inotify-simple.readthedocs.io/en/latest/#inotify_simple.INotify.add_watch
mvsusp
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- please create test cases for the new behavior
| if flag is inotify_simple.flags.ISDIR and inotify_simple.flags.CREATE & event.mask: | ||
| for folder, dirs, files in os.walk(os.path.join(intermediate_path, event.name)): | ||
| path = os.path.join( | ||
| *[intermediate_path] + [watchers[wd] for wd in range(1, event.wd + 1)] + [event.name]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please extract this logic outside os.path.join to be more readable and easier to understand.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was an issue with this. I have fixed it in the latest commit.
|
We have a test that was supposed to test for this behavior, but failed :( |
|
Tests failed because of this numpy bug: |
Codecov Report
@@ Coverage Diff @@
## master #164 +/- ##
==========================================
- Coverage 92.75% 92.67% -0.08%
==========================================
Files 25 25
Lines 1159 1160 +1
Branches 117 117
==========================================
Hits 1075 1075
Misses 55 55
- Partials 29 30 +1
Continue to review full report at Codecov.
|
Since event.name of inotify just returns the folder name if a new folder is created, the directory structure wasn't being walked properly. This change fixes the bug to enable correct traversal of the directory.