def test_is_older3(self): """ compare a dependency group to a singular dependency """ dep1a = Dataset(fullpath("testdata/1a")) dep1b = Dataset(fullpath("testdata/1b")) dep1c = Dataset(fullpath("testdata/1c")) group1 = DatasetGroup(fullpath("testdata/1"), [dep1a, dep1b, dep1c]) for dep in group1: makefile(dep.name) time.sleep(0.05) dep2 = Dataset(fullpath("testdata/2")) makefile(dep2.name) self.assertTrue(group1.is_older_than(dep2))
def test_children(self): d1a = Dataset("1a") d1b = Dataset("1b") d1c = Dataset("1c") d1d = Dataset("1d") d2a = Dataset("2a") d2b = Dataset("2b") d2c = Dataset("2c") d2a.dependson(d1a, d1b) d2b.dependson(d1c) d2c.dependson(d1d) dg = DatasetGroup("dg", [d1a, d1b, d1c]) self.assertEqual(set(dg.children()), set([d2a, d2b]))
def test_is_older2(self): """ define two dependency groups, where files ages overlap, and so group 1 is not absolutely older than group 2 """ dep1a = Dataset(fullpath("testdata/1a")) dep1b = Dataset(fullpath("testdata/1b")) dep2c = Dataset(fullpath("testdata/2c")) for dep in (dep1a, dep1b, dep2c): makefile(dep.name) time.sleep(0.05) dep1c = Dataset(fullpath("testdata/1c")) dep2a = Dataset(fullpath("testdata/2a")) dep2b = Dataset(fullpath("testdata/2b")) for dep in (dep1c, dep2a, dep2b): makefile(dep.name) group1 = DatasetGroup(fullpath("testdata/1"), [dep1a, dep1b, dep1c]) group2 = DatasetGroup(fullpath("testdata/2"), [dep2a, dep2b, dep2c]) self.assertFalse(group1.is_older_than(group2))
def test_is_older1(self): """ define two dependency groups, where all files are older in one than in the other. """ dep1a = Dataset(fullpath("testdata/1a")) dep1b = Dataset(fullpath("testdata/1b")) dep1c = Dataset(fullpath("testdata/1c")) for dep in (dep1a, dep1b, dep1c): makefile(dep.name) time.sleep(0.05) dep2a = Dataset(fullpath("testdata/2a")) dep2b = Dataset(fullpath("testdata/2b")) dep2c = Dataset(fullpath("testdata/2c")) for dep in (dep2a, dep2b, dep2c): makefile(dep.name) group1 = DatasetGroup(fullpath("testdata/1"), [dep1a, dep1b, dep1c]) group2 = DatasetGroup(fullpath("testdata/2"), [dep2a, dep2b, dep2c]) self.assertTrue(group1.is_older_than(group2))