-
-
Notifications
You must be signed in to change notification settings - Fork 704
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
Fix tests on macOS #729
Fix tests on macOS #729
Conversation
Thanks a lot! |
I am happy to help. That being said, all of those checks and fixes really should have been part of the review process for #680. Writing a complete overhaul of the macOS backend without detailed manual or automated testing was just asking for trouble... |
Yeah, apologies for the mess that ensued afterwards. I really should have made sure that the automated tests work first to spot many of the issues that cropped up. Manual testing is way too unreliable when it needs to be performed multiple times against different co-existing versions on the same machine. But that aside, regarding this point:
|
The good thing is: you are now both working on improving the macOS support reliably, so thank you both very much ❤️ |
No worries, your quick reaction time makes working on fixes very easy :) I am still confused about the temporal coalescing of events. The Is setting the latency to 0 feasible? Or a really bad idea? Edit: Correct that, there are only 30 reported events, even when setting the latency to 0. We could queue both created and deleted events in the emitter for such combined native events but the trouble is determining the correct order. A call to |
@CCP-Aporia, yes, that flush has been confusing me. Any idea why those historic events are reported? I have not encountered this with manual testing, only from the test suite. |
Presumably they are reported in the test suite because the time between the filesystem operations and adding the watch is incredibly short - fseventsd is a separate process, so a bit of a race condition should be expected here. First experiments with a |
So, I've done some more experimenting and noticed that the tests kept failing even with the
Now, that 30 second interval doesn't appear to be entirely true anymore. And edit: This also means that the |
Oh wow, that article is a nice find! Yes, it does looks like we will need an We will also need to generate a tree of events for moved parent folders, similar to what is done on the inotify backend with I am not a huge fan of all of this but it looks like we have no choice. It's certainly better than going back to snapshot diffs. Still, it should probably be done in separate PRs. And maybe after this PR is merged. It's always good to have the tests as a reference point and then work towards making them pass. What do you think? Finally, it looks like we will still need a long waiting time to flush old events since we really don't want to deal with those leaking into the tests in unpredictable ways. |
Indeed, there are a few things that we need to implement in order to provide a correct FSEvents based observer. But also, since I assume that we want to have the same behaviour across all operating systems: What do we consider as expected behaviour? The emitter tests contain a bunch of special casing for different operating systems, which makes it difficult to provide consistent behaviour across different platforms. Of course, there are inherent differences between the platforms, but we might want to provide a base line somehow - otherwise the event translation is a bit of a mood point as users of this library would still need to write platform-specific code for a lot of cases. |
I agree, uniform behaviour across all platforms would be ideal. If this is impossible, a common and documented baseline is the next best thing. But before we achieve any of that, the more immediate goal to me is a usable emitter on macOS (not crashing, not emitting only half of the events...) that provides at least the granularity of events as the last working release. For this, my aim was to take the tests as they currently are ("expected behaviour"), assuming that any user-land code is already dealing with existing differences between platforms, and ensure that they pass reliably. IMO, the larger goal of unifying the emitted events across platforms is a breaking change and therefore something for a 2.0 release. |
One thing that crossed my mind regarding the Additionally increasing the timeout for the |
Sorry guys, I did the 1.0.2 release. I was trying to add wheels to the current release and it seems the master branch was used ... So let's rebase your work on master. |
v0.10.4 of the "watchdog" package had an extensive update to the "fsevent" observer, which appears to have broken functionality the Plastron InboxWatcher relies on (gorakhargosh/watchdog#680) The problem still exists in the latest current watchdog version (v1.0.2), so pinning the "watchdog" package to v0.10.3 is the simplest fix for now. In gorakhargosh/watchdog#729 it is noted that the watchdog MacOS tests are failing, and that there are known issues with fsevent. The "tests/stomp/test_inbox_watcher.py" passed when using v0.10.3, and fails in v0.10.4 and later, so it can be used to gauge whether "watchdog" is performing as expected by Plastron. https://issues.umd.edu/browse/LIBFCREPO-944
v0.10.4 of the "watchdog" package had an extensive update to the "fsevent" observer, which appears to have broken functionality the Plastron InboxWatcher relies on (gorakhargosh/watchdog#680). In gorakhargosh/watchdog#729 it is noted hat the watchdog MacOS tests are failing, and that there are known issues with fsevent. The problem still exists in the latest current watchdog version (v1.0.2), so pinning the "watchdog" package to v0.10.3 is the simplest fix for now. The "tests/stomp/test_inbox_watcher.py" passed when using v0.10.3, and fails in v0.10.4 and later, so it can be used to gauge whether "watchdog" is performing as expected by Plastron. https://issues.umd.edu/browse/LIBFCREPO-944
Closed by #734. |
This PR fixes the tests on macOS. Closes #546. Notably:
Most of the tests will pass after all the other PRs for macOS have been merged. One exception to this is the
test_fast_subdirectory_creation_deletion
test. This is problematic because the native events, while having the correct total count, all have both theis_created
andis_removed
flags set. I haven't figured out yet if this is a limitation of FSEvents or an error in watchdog.