Ejemplo n.º 1
0
	def test_tree_watcher(self):
		from powerline.lib.tree_watcher import TreeWatcher
		tw = TreeWatcher()
		subdir = os.path.join(INOTIFY_DIR, 'subdir')
		os.mkdir(subdir)
		if tw.watch(INOTIFY_DIR).is_dummy:
			raise SkipTest('No tree watcher available')
		import shutil
		self.assertTrue(tw(INOTIFY_DIR))
		self.assertFalse(tw(INOTIFY_DIR))
		changed = partial(self.do_test_for_change, tw, INOTIFY_DIR)
		open(os.path.join(INOTIFY_DIR, 'tree1'), 'w').close()
		changed()
		open(os.path.join(subdir, 'tree1'), 'w').close()
		changed()
		os.unlink(os.path.join(subdir, 'tree1'))
		changed()
		os.rmdir(subdir)
		changed()
		os.mkdir(subdir)
		changed()
		os.rename(subdir, subdir + '1')
		changed()
		shutil.rmtree(subdir + '1')
		changed()
		os.mkdir(subdir)
		f = os.path.join(subdir, 'f')
		open(f, 'w').close()
		changed()
		with open(f, 'a') as s:
			s.write(' ')
		changed()
		os.rename(f, f + '1')
		changed()
Ejemplo n.º 2
0
	def test_tree_watcher(self):
		from powerline.lib.tree_watcher import TreeWatcher
		tw = TreeWatcher()
		subdir = os.path.join(INOTIFY_DIR, 'subdir')
		os.mkdir(subdir)
		if tw.watch(INOTIFY_DIR).is_dummy:
			raise SkipTest('No tree watcher available')
		import shutil
		self.assertTrue(tw(INOTIFY_DIR))
		self.assertFalse(tw(INOTIFY_DIR))
		changed = partial(self.do_test_for_change, tw, INOTIFY_DIR)
		open(os.path.join(INOTIFY_DIR, 'tree1'), 'w').close()
		changed()
		open(os.path.join(subdir, 'tree1'), 'w').close()
		changed()
		os.unlink(os.path.join(subdir, 'tree1'))
		changed()
		os.rmdir(subdir)
		changed()
		os.mkdir(subdir)
		changed()
		os.rename(subdir, subdir + '1')
		changed()
		shutil.rmtree(subdir + '1')
		changed()
		os.mkdir(subdir)
		f = os.path.join(subdir, 'f')
		open(f, 'w').close()
		changed()
		with open(f, 'a') as s:
			s.write(' ')
		changed()
		os.rename(f, f + '1')
		changed()
Ejemplo n.º 3
0
    def test_tree_watcher(self):
        from powerline.lib.tree_watcher import TreeWatcher

        tw = TreeWatcher()
        subdir = os.path.join(INOTIFY_DIR, "subdir")
        os.mkdir(subdir)
        if tw.watch(INOTIFY_DIR).is_dummy:
            raise SkipTest("No tree watcher available")
        import shutil

        self.assertTrue(tw(INOTIFY_DIR))
        self.assertFalse(tw(INOTIFY_DIR))
        changed = partial(self.do_test_for_change, tw, INOTIFY_DIR)
        open(os.path.join(INOTIFY_DIR, "tree1"), "w").close()
        changed()
        open(os.path.join(subdir, "tree1"), "w").close()
        changed()
        os.unlink(os.path.join(subdir, "tree1"))
        changed()
        os.rmdir(subdir)
        changed()
        os.mkdir(subdir)
        changed()
        os.rename(subdir, subdir + "1")
        changed()
        shutil.rmtree(subdir + "1")
        changed()
        os.mkdir(subdir)
        f = os.path.join(subdir, "f")
        open(f, "w").close()
        changed()
        with open(f, "a") as s:
            s.write(" ")
        changed()
        os.rename(f, f + "1")
        changed()
Ejemplo n.º 4
0
 def __init__(self):
     from powerline.lib.tree_watcher import TreeWatcher
     self.tw = TreeWatcher()