Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve handling of rename events on macOS #750

Merged
merged 20 commits into from
Jan 21, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/watchdog/observers/fsevents.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ def queue_events(self, timeout, events):

while events:
event = events.pop(0)
logger.info(event)
flags = ", ".join(attr for attr in dir(event) if getattr(event, attr) is True)
logger.info(f"{event}: {flags}")
BoboTiG marked this conversation as resolved.
Show resolved Hide resolved
src_path = self._encode_path(event.path)

if event.is_renamed:
Expand Down
3 changes: 2 additions & 1 deletion src/watchdog_fsevents.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ PyObject* NativeEventTypeInode(PyObject* instance, void* closure)
{
UNUSED(closure);
NativeEventObject *self = (NativeEventObject*)instance;
return PyLong_FromLong(self->inode);
Py_INCREF(self->inode);
return self->inode;
}

PyObject* NativeEventTypeID(PyObject* instance, void* closure)
Expand Down
6 changes: 6 additions & 0 deletions tests/test_emitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@
logger = logging.getLogger(__name__)


if platform.is_darwin():
# enable more verbose logs
fsevents_logger = logging.getLogger("fsevents")
fsevents_logger.setLevel(logging.INFO)
BoboTiG marked this conversation as resolved.
Show resolved Hide resolved


@pytest.fixture(autouse=True)
def setup_teardown(tmpdir):
global p, emitter, event_queue
Expand Down