def test_unmount_watched_directory_filesystem(p): mkdir(p('dir1')) mount_tmpfs(p('dir1')) mkdir(p('dir1/dir2')) inotify = InotifyBuffer(p('dir1/dir2').encode()) unmount(p('dir1')) # Wait for the event to be picked up inotify.read_event() # Ensure InotifyBuffer shuts down cleanly without raising an exception inotify.close() assert not inotify.is_alive()
def test_close_should_terminate_thread(p): inotify = InotifyBuffer(p('').encode(), recursive=True) assert inotify.is_alive() inotify.close() assert not inotify.is_alive()