def run(self): with CliReporter(self.env, verbosity=self.verbosity): self.build(update_source_info_first=True) with Watcher(self.env, self.output_path) as watcher: for ts, _, _ in watcher: if self.last_build is None or ts > self.last_build: self.build()
def test_is_interesting(env): # pylint: disable=no-member cache_dir = py.path.local(utils.get_cache_dir()) build_dir = py.path.local("build") w = Watcher(env, str(build_dir)) # This partial makes the testing code shorter is_interesting = functools.partial(w.is_interesting, 0, "generic") assert is_interesting("a.file") assert not is_interesting(".file") assert not is_interesting(str(cache_dir / "another.file")) assert not is_interesting(str(build_dir / "output.file")) w.output_path = None assert is_interesting(str(build_dir / "output.file"))
def __init__(self, env, output_path, verbosity=0, build_flags=None): threading.Thread.__init__(self) watcher = Watcher(env, output_path) watcher.observer.start() self.env = env self.watcher = watcher self.output_path = output_path self.verbosity = verbosity self.last_build = time.time() self.build_flags = build_flags