def testUnranProcs(self, procs, starts, outs): for p in procs: ProcTree.register(p) pt = ProcTree() pt.setStarts(starts) # run the pipeline p = pt.getNextToRun() while p: ProcTree.NODES[p].ran = True p = pt.getNextToRun() self.assertDictEqual(pt.unranProcs(), outs)
def testGetNextToRun(self, procs, starts, haveran, out): for p in procs: ProcTree.register(p) pt = ProcTree() pt.setStarts(starts) for hr in haveran: ProcTree.NODES[hr].ran = True self.assertIs(pt.getNextToRun(), out)
def test_proctree_getnexttorun(set2): # p15 -> p16 -> p17 -> 19 # p14 _/ \_ p18_/ \_ p20 # hide p1 = Proc() #ProcTree.register(p1) p2 = Proc() p2.depends = p1 pt = ProcTree() pt.init() pt.setStarts([set2.p14, set2.p15]) pt.NODES[set2.p14].ran = True assert pt.getNextToRun() is set2.p15 pt.NODES[set2.p15].ran = True assert pt.getNextToRun() is set2.p16 pt.NODES[set2.p16].ran = True assert pt.getNextToRun() is set2.p18 pt.NODES[set2.p18].ran = True assert pt.getNextToRun() is set2.p17 pt.NODES[set2.p17].ran = True assert pt.getNextToRun() is set2.p20 pt.NODES[set2.p20].ran = True assert pt.getNextToRun() is set2.p19 pt.NODES[set2.p19].ran = True assert pt.getNextToRun() is None