Esempio n. 1
0
    def test_simple(self):
        scheduler = CommandScheduler()
        scheduler.set_before("task2", "task1")
        scheduler.set_after("task2", "task3")
        scheduler.set_after("task2", "task4")
        scheduler.set_before("task4", "task3")

        tasks = scheduler.order("task4")
        self.assertEqual(tasks, ["task1", "task2", "task3"])
Esempio n. 2
0
    def test_simple(self):
        scheduler = CommandScheduler()
        scheduler.set_before("task2", "task1")
        scheduler.set_after("task2", "task3")
        scheduler.set_after("task2", "task4")
        scheduler.set_before("task4", "task3")

        tasks = scheduler.order("task4")
        self.assertEqual(tasks, ["task1", "task2", "task3"])
Esempio n. 3
0
    def test_cycle(self):
        scheduler = CommandScheduler()
        scheduler.set_before("task2", "task1")
        scheduler.set_before("task1", "task2")

        self.assertRaises(ValueError, lambda: scheduler.order("task1"))
Esempio n. 4
0
    def test_cycle(self):
        scheduler = CommandScheduler()
        scheduler.set_before("task2", "task1")
        scheduler.set_before("task1", "task2")

        self.assertRaises(ValueError, lambda: scheduler.order("task1"))