Example #1
0
    def test_compute_priority(self):
        r_priority = dict((name, i) for i, name in \
                           enumerate(["first", "second", "third", "fourth"]))

        scheduler = Scheduler()
        scheduler.set_constraints("second", "first", "third")
        scheduler.set_constraints("third", before="fourth")

        self.assertEqual(scheduler.compute_priority(), r_priority)
Example #2
0
    def test_after(self):
        scheduler = Scheduler()
        scheduler.set_constraints("second", "first")
        scheduler.set_constraints("third", "second")

        self.assertEqual(scheduler.order("third"), ["first", "second"])
Example #3
0
    def test_cycle(self):
        scheduler = Scheduler()
        scheduler.set_constraints("second", before="third")
        scheduler.set_constraints("third", before="second")

        self.assertRaises(DepSolverError, lambda: scheduler.order("third"))
Example #4
0
    def test_before(self):
        scheduler = Scheduler()
        scheduler.set_constraints("second", before="third")
        scheduler.set_constraints("first", before="second")

        self.assertEqual(scheduler.order("third"), ["first", "second"])