当前位置: 首页>>代码示例>>Python>>正文


Python TaskControl._add_task方法代码示例

本文整理汇总了Python中doit.control.TaskControl._add_task方法的典型用法代码示例。如果您正苦于以下问题:Python TaskControl._add_task方法的具体用法?Python TaskControl._add_task怎么用?Python TaskControl._add_task使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在doit.control.TaskControl的用法示例。


在下文中一共展示了TaskControl._add_task方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: testChangeOrder_AddJustOnce

# 需要导入模块: from doit.control import TaskControl [as 别名]
# 或者: from doit.control.TaskControl import _add_task [as 别名]
 def testChangeOrder_AddJustOnce(self):
     tasks = [Task("taskX",None,task_dep=["taskY"]),
              Task("taskY",None,)]
     tc = TaskControl(tasks)
     tc.process(None)
     assert [tasks[1], tasks[0]] == [x for x in tc._add_task(0, 'taskX', False)]
     # both tasks were already added. so no tasks left..
     assert [] == [x for x in tc._add_task(0, 'taskY', False)]
开发者ID:jergason,项目名称:topicalguide,代码行数:10,代码来源:test_control.py

示例2: testParallel

# 需要导入模块: from doit.control import TaskControl [as 别名]
# 或者: from doit.control.TaskControl import _add_task [as 别名]
 def testParallel(self):
     tasks = [Task("taskX",None,task_dep=["taskY"]),
              Task("taskY",None)]
     tc = TaskControl(tasks)
     tc.process(None)
     gen1 = tc._add_task(0, "taskX", False)
     assert tasks[1] == gen1.next()
     # gen2 wont get any task, because it was already being processed
     gen2 = tc._add_task(1, "taskY", False)
     py.test.raises(StopIteration, gen2.next)
开发者ID:jergason,项目名称:topicalguide,代码行数:12,代码来源:test_control.py

示例3: testDetectCyclicReference

# 需要导入模块: from doit.control import TaskControl [as 别名]
# 或者: from doit.control.TaskControl import _add_task [as 别名]
 def testDetectCyclicReference(self):
     tasks = [Task("taskX",None,task_dep=["taskY"]),
              Task("taskY",None,task_dep=["taskX"])]
     tc = TaskControl(tasks)
     tc.process(None)
     gen = tc._add_task(0, "taskX", False)
     py.test.raises(InvalidDodoFile, gen.next)
开发者ID:jergason,项目名称:topicalguide,代码行数:9,代码来源:test_control.py

示例4: testSetupInvalid

# 需要导入模块: from doit.control import TaskControl [as 别名]
# 或者: from doit.control.TaskControl import _add_task [as 别名]
 def testSetupInvalid(self):
     tasks = [Task("taskX",None,setup=["taskZZZZZZZZ"]),
              Task("taskY",None,)]
     tc = TaskControl(tasks)
     tc.process(['taskX'])
     gen = tc._add_task(0, 'taskX', False)
     assert tasks[0] == gen.next() # tasks with setup are yield twice
     tasks[0].run_status = 'run' # should be executed
     py.test.raises(InvalidTask, gen.next) # execute setup before
开发者ID:jergason,项目名称:topicalguide,代码行数:11,代码来源:test_control.py

示例5: testSetupTasksDontRun

# 需要导入模块: from doit.control import TaskControl [as 别名]
# 或者: from doit.control.TaskControl import _add_task [as 别名]
 def testSetupTasksDontRun(self):
     tasks = [Task("taskX",None,setup=["taskY"]),
              Task("taskY",None,)]
     tc = TaskControl(tasks)
     tc.process(['taskX'])
     gen = tc._add_task(0, 'taskX', False)
     assert tasks[0] == gen.next()
     # X is up-to-date
     tasks[0].run_status = 'up-to-date'
     py.test.raises(StopIteration, gen.next)
开发者ID:jergason,项目名称:topicalguide,代码行数:12,代码来源:test_control.py

示例6: testSetupTasksRun

# 需要导入模块: from doit.control import TaskControl [as 别名]
# 或者: from doit.control.TaskControl import _add_task [as 别名]
 def testSetupTasksRun(self):
     tasks = [Task("taskX",None,setup=["taskY"]),
              Task("taskY",None,)]
     tc = TaskControl(tasks)
     tc.process(['taskX'])
     gen = tc._add_task(0, 'taskX', False)
     assert tasks[0] == gen.next() # tasks with setup are yield twice
     tasks[0].run_status = 'run' # should be executed
     assert tasks[1] == gen.next() # execute setup before
     assert tasks[0] == gen.next() # second time, ok
     py.test.raises(StopIteration, gen.next) # nothing left
开发者ID:jergason,项目名称:topicalguide,代码行数:13,代码来源:test_control.py

示例7: testIncludeSetup

# 需要导入模块: from doit.control import TaskControl [as 别名]
# 或者: from doit.control.TaskControl import _add_task [as 别名]
 def testIncludeSetup(self):
     # with include_setup yield all tasks without waiting for setup tasks to
     # be ready
     tasks = [Task("taskX",None,setup=["taskY"]),
              Task("taskY",None,)]
     tc = TaskControl(tasks)
     tc.process(['taskX'])
     gen = tc._add_task(0, 'taskX', True) # <== include_setup
     assert tasks[0] == gen.next() # tasks with setup are yield twice
     assert tasks[1] == gen.next() # execute setup before
     assert tasks[0] == gen.next() # second time, ok
     py.test.raises(StopIteration, gen.next) # nothing left
开发者ID:jergason,项目名称:topicalguide,代码行数:14,代码来源:test_control.py

示例8: testCalcDep

# 需要导入模块: from doit.control import TaskControl [as 别名]
# 或者: from doit.control.TaskControl import _add_task [as 别名]
 def testCalcDep(self):
     def get_deps():
         print "gget"
         return {'file_dep': ('a', 'b')}
     tasks = [Task("taskX", None, calc_dep=['task_dep']),
              Task("task_dep", [(get_deps,)]),
              ]
     tc = TaskControl(tasks)
     tc.process(['taskX'])
     gen = tc._add_task(0, 'taskX', False)
     assert tasks[1] == gen.next()
     assert isinstance(gen.next(), WaitRunTask)
     tasks[1].execute()
     assert tasks[0] == gen.next()
     assert set(['a', 'b']) == tasks[0].file_dep
开发者ID:jergason,项目名称:topicalguide,代码行数:17,代码来源:test_control.py

示例9: testWaitSetup

# 需要导入模块: from doit.control import TaskControl [as 别名]
# 或者: from doit.control.TaskControl import _add_task [as 别名]
 def testWaitSetup(self):
     tasks = [Task("taskX",None,setup=["taskY"]),
              Task("taskY",None,)]
     tc = TaskControl(tasks)
     tc.process(['taskX'])
     gen = tc._add_task(0, 'taskX', False)
     assert tasks[0] == gen.next() # tasks with setup are yield twice
     # wait for taskX run_status
     wait = gen.next()
     assert wait.task_name == 'taskX'
     assert isinstance(wait, WaitSelectTask)
     tasks[0].run_status = 'run' # should be executed
     assert tasks[1] == gen.next() # execute setup before
     assert tasks[0] == gen.next() # second time, ok
     py.test.raises(StopIteration, gen.next) # nothing left
开发者ID:jergason,项目名称:topicalguide,代码行数:17,代码来源:test_control.py

示例10: testAddNotSelected

# 需要导入模块: from doit.control import TaskControl [as 别名]
# 或者: from doit.control.TaskControl import _add_task [as 别名]
 def testAddNotSelected(self):
     tasks = [Task("taskX",None,task_dep=["taskY"]),
              Task("taskY",None,)]
     tc = TaskControl(tasks)
     tc.process(['taskX'])
     assert [tasks[1], tasks[0]] == [x for x in tc._add_task(0, 'taskX',False)]
开发者ID:jergason,项目名称:topicalguide,代码行数:8,代码来源:test_control.py


注:本文中的doit.control.TaskControl._add_task方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。