-
-
Notifications
You must be signed in to change notification settings - Fork 704
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'gorakhargosh:master' into master
- Loading branch information
Showing
14 changed files
with
189 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
if __name__ == "__main__": | ||
import eventlet | ||
|
||
eventlet.monkey_patch() | ||
|
||
import signal | ||
import sys | ||
import tempfile | ||
|
||
from watchdog.events import LoggingEventHandler | ||
from watchdog.observers import Observer | ||
|
||
with tempfile.TemporaryDirectory() as temp_dir: | ||
|
||
def run_observer(): | ||
event_handler = LoggingEventHandler() | ||
observer = Observer() | ||
observer.schedule(event_handler, temp_dir) | ||
observer.start() | ||
eventlet.sleep(1) | ||
observer.stop() | ||
|
||
def on_alarm(signum, frame): | ||
print("Observer.stop() never finished!", file=sys.stderr) # noqa: T201 | ||
sys.exit(1) | ||
|
||
signal.signal(signal.SIGALRM, on_alarm) | ||
signal.alarm(4) | ||
|
||
thread = eventlet.spawn(run_observer) | ||
thread.wait() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
if __name__ == "__main__": | ||
import eventlet | ||
|
||
eventlet.monkey_patch() | ||
|
||
from watchdog.utils.bricks import SkipRepeatsQueue | ||
|
||
q = SkipRepeatsQueue(10) | ||
q.put("A") | ||
q.put("A") | ||
q.put("A") | ||
q.put("A") | ||
q.put("B") | ||
q.put("A") | ||
|
||
value = q.get() | ||
assert value == "A" | ||
q.task_done() | ||
|
||
assert q.unfinished_tasks == 2 | ||
|
||
value = q.get() | ||
assert value == "B" | ||
q.task_done() | ||
|
||
assert q.unfinished_tasks == 1 | ||
|
||
value = q.get() | ||
assert value == "A" | ||
q.task_done() | ||
|
||
assert q.empty() | ||
assert q.unfinished_tasks == 0 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import importlib | ||
|
||
import pytest | ||
|
||
from watchdog.utils import platform | ||
|
||
from .utils import run_isolated_test | ||
|
||
|
||
# Kqueue isn't supported by Eventlet, so BSD is out | ||
# Current usage ReadDirectoryChangesW on Windows is blocking, though async may be possible | ||
@pytest.mark.skipif(not platform.is_linux(), reason="Eventlet only supported in Linux") | ||
def test_observer_stops_in_eventlet(): | ||
if not importlib.util.find_spec("eventlet"): | ||
pytest.skip("eventlet not installed") | ||
|
||
run_isolated_test("eventlet_observer_stops.py") | ||
|
||
|
||
@pytest.mark.skipif(not platform.is_linux(), reason="Eventlet only supported in Linux") | ||
def test_eventlet_skip_repeat_queue(): | ||
if not importlib.util.find_spec("eventlet"): | ||
pytest.skip("eventlet not installed") | ||
|
||
run_isolated_test("eventlet_skip_repeat_queue.py") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters