def test_watch_graph_caches(self): """ Watching a graph will raise StopProcessing if no file changes """ self.make_files(foo='foo', bar='bar') with pike.Graph('g') as graph: pike.glob('.', '*') watcher = pike.watch_graph(graph) ret = watcher.run() self.assertEqual(len(ret['default']), 2) with self.assertRaises(pike.StopProcessing): watcher.run()
def test_watch_graph_partial_changes(self): """ Watching a graph with partial runs will return new files """ self.make_files(foo='foo', bar='bar') with pike.Graph('g') as graph: pike.glob('.', '*') watcher = pike.watch_graph(graph, partial=True) ret = watcher.run() self.assertItemsEqual([f.data.read() for f in ret['default']], [b'foo', b'bar']) self.make_files(foo='foo', bar='foo') ret = watcher.run() self.assertItemsEqual([f.data.read() for f in ret['default']], [b'foo', b'foo'])