def test_proctree_getallpaths_single(): p1 = Proc() ProcTree.register(p1) pt = ProcTree() pt.setStarts([p1]) assert list(pt.getAllPaths()) == [[p1]]
def test_proctree_getallpaths(set2): # p15 -> p16 -> p17 -> 19 # p14 _/ \_ p18_/ \_ p20 # ##hide moved to plugin pt = ProcTree() pt.init() pt.setStarts([set2.p14, set2.p15]) allpath = list(pt.getAllPaths()) assert len(allpath) == 8 assert [set2.p19, set2.p17, set2.p16, set2.p14] in allpath assert [set2.p19, set2.p17, set2.p16, set2.p15] in allpath assert [set2.p20, set2.p17, set2.p16, set2.p14] in allpath assert [set2.p20, set2.p17, set2.p16, set2.p15] in allpath assert [set2.p19, set2.p17, set2.p18, set2.p16, set2.p14] in allpath assert [set2.p19, set2.p17, set2.p18, set2.p16, set2.p15] in allpath assert [set2.p20, set2.p17, set2.p18, set2.p16, set2.p14] in allpath assert [set2.p20, set2.p17, set2.p18, set2.p16, set2.p15] in allpath
def testGetAllPaths(self, procs, starts, paths): for p in procs: ProcTree.register(p) pt = ProcTree() pt.setStarts(starts) self.assertCountEqual(pt.getAllPaths(), paths)