예제 #1
0
 def test_no_double_invoke(self):
     runlist = []
     t1 = Task('t1', action=lambda t: runlist.append(t.name))
     t2 = Task('t2', depends=[t1], action=lambda t: runlist.append(t.name))
     t3 = Task('t3', depends=[t2, t1], action=lambda t: runlist.append(t.name))
     self.manage.add(t1)
     self.manage.add(t2)
     self.manage.add(t3)
     self.manage.invoke('t3')
     self.assertEqual(['t1', 't2', 't3'], runlist)
예제 #2
0
    def test_invoke_with_circular_dependencies(self):
        runlist = []
        t1 = Task('t1')
        t2 = Task('t2', depends=[t1])
        t1.depends = [t2]
        self.manage.add(t1)
        self.manage.add(t2)

        with self.assertRaises(RuntimeError):
            self.manage.invoke('t1')
예제 #3
0
 def test_invoke(self):
     runlist = []
     t1 = Task('t1', action=lambda t: runlist.append(t.name))
     t2 = Task('t2', action=lambda t: runlist.append(t.name))
     self.manage.add(t1)
     self.manage.add(t2)
     self.manage.add(Task('t3', depends=[t1, t2],
                     action = lambda t: runlist.append(t.name)))
     self.manage.invoke('t3')
     self.assertEqual(runlist, ['t1', 't2', 't3'])
예제 #4
0
파일: test_task.py 프로젝트: vuuvv/vake
    def test_call(self):
        self.flag = True
        def func(task):
            self.flag = False

        t1 = Task("t1", action=func)
        self.assertEquals(True, self.flag)
        t1()
        self.assertEquals(False, self.flag)
예제 #5
0
파일: test_task.py 프로젝트: vuuvv/vake
 def test_create(self):
     t = Task("t")
     self.assertEquals("t", t.name)
     self.assertEquals([], t.depends)
     self.assertEquals(empty, t.action)
     self.assertTrue(t.needed())
예제 #6
0
파일: test_task.py 프로젝트: vuuvv/vake
 def test_repr(self):
     t1 = Task("t1")
     t2 = Task("t2")
     t = Task("t", [t1, t2])
     self.assertEquals('<Task t => [t1,t2]>', str(t))
예제 #7
0
 def test_remove(self):
     name = 'I will be remove'
     self.manage.add(Task(name))
     self.manage.remove(name)
     with self.assertRaises(TaskNotFound):
         self.manage.find(name)
예제 #8
0
 def test_add_duplication(self):
     with self.assertRaises(DuplicatedTaskName) as context:
         name = 'duplicate name'
         self.manage.add(Task(name))
         self.manage.add(Task(name))