示例#1
0
 def makeEmitter(self, path=None):
     """
     Return a new emitter monitoring `path`.
     """
     return InotifyEmitter(
         event_queue=self.emitter_queue,
         watch=self.ObservedWatch(path=path),
         timeout=0,
         )
示例#2
0
def test_close_clean(tmpdir):
    """
    On InotifyBuffer.close() InotifyBuffer.read_event() is un-blocked so that
    Inotify thread waiting for it can be closed.

    This is also a test for Inotify.queue_events handling of STOP_EVENT and
    InotifyBuffer.close() is test as side effect of Inotify.stop()
    """
    watch = ObservedWatch(path=tmpdir, recursive=False)
    emitter = InotifyEmitter([], watch)
    emitter.start()

    emitter.stop()
    emitter.join(1)
    assert not emitter.isAlive()