Ejemplo n.º 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)
Ejemplo n.º 2
0
 def on_thread_stop(self):
     if self.watch:
         _fsevents.remove_watch(self.watch)
         _fsevents.stop(self)
         self._watch = None
Ejemplo n.º 3
0
 def on_thread_stop(self):
     _fsevents.remove_watch(self.watch)
     _fsevents.stop(self)
Ejemplo n.º 4
0
 def on_thread_stop(self):
     _fsevents.remove_watch(self.watch)
     _fsevents.stop(self)
Ejemplo n.º 5
0
 def on_thread_stop(self):
     if self.watch:
         _fsevents.remove_watch(self.watch)
         _fsevents.stop(self)
         self._watch = None