示例#1
0
def test_add_watch_twice(observer):
    """ Adding the same watch twice used to result in a null pointer return without an exception.

    See https://github.com/gorakhargosh/watchdog/issues/765
    """

    a = p("a")
    mkdir(a)
    h = FileSystemEventHandler()
    w = ObservedWatch(a, recursive=False)

    def callback(path, inodes, flags, ids):
        pass

    _fsevents.add_watch(h, w, callback, [w.path])
    with pytest.raises(RuntimeError):
        _fsevents.add_watch(h, w, callback, [w.path])
    _fsevents.remove_watch(w)
    rmdir(a)
示例#2
0
 def on_thread_stop(self):
     if self.watch:
         _fsevents.remove_watch(self.watch)
         _fsevents.stop(self)
         self._watch = None
示例#3
0
 def on_thread_stop(self):
     _fsevents.remove_watch(self.watch)
     _fsevents.stop(self)
示例#4
0
 def on_thread_stop(self):
     _fsevents.remove_watch(self.watch)
     _fsevents.stop(self)
示例#5
0
 def on_thread_stop(self):
     if self.watch:
         _fsevents.remove_watch(self.watch)
         _fsevents.stop(self)
         self._watch = None