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


Python Task.execute方法代码示例

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


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

示例1: test_reverse_order

# 需要导入模块: from doit.task import Task [as 别名]
# 或者: from doit.task.Task import execute [as 别名]
 def test_reverse_order(self, reporter, dep_manager):
     def do_nothing():pass
     t1 = Task('t1', [], teardown=[do_nothing])
     t2 = Task('t2', [], teardown=[do_nothing])
     my_runner = runner.Runner(dep_manager, reporter)
     my_runner.teardown_list = [t1, t2]
     t1.execute()
     t2.execute()
     my_runner.teardown()
     assert ('teardown', t2) == reporter.log.pop(0)
     assert ('teardown', t1) == reporter.log.pop(0)
     assert not reporter.log
开发者ID:barleyj,项目名称:doit,代码行数:14,代码来源:test_runner.py

示例2: test_ok

# 需要导入模块: from doit.task import Task [as 别名]
# 或者: from doit.task.Task import execute [as 别名]
 def test_ok(self, reporter, dep_manager):
     touched = []
     def touch():
         touched.append(1)
     t1 = Task('t1', [], teardown=[(touch,)])
     my_runner = runner.Runner(dep_manager, reporter)
     my_runner.teardown_list = [t1]
     t1.execute()
     my_runner.teardown()
     assert 1 == len(touched)
     assert ('teardown', t1) == reporter.log.pop(0)
     assert not reporter.log
开发者ID:barleyj,项目名称:doit,代码行数:14,代码来源:test_runner.py

示例3: test

# 需要导入模块: from doit.task import Task [as 别名]
# 或者: from doit.task.Task import execute [as 别名]
 def test(self):
     def sample():
         print("this is printed")
     t1 = Task("t1", [(sample,)])
     result = reporter.TaskResult(t1)
     result.start()
     t1.execute(Stream(0))
     result.set_result('success')
     got = result.to_dict()
     assert t1.name == got['name'], got
     assert 'success' == got['result'], got
     assert "this is printed\n" == got['out'], got
     assert "" == got['err'], got
     assert got['started']
     assert 'elapsed' in got
开发者ID:pydoit,项目名称:doit,代码行数:17,代码来源:test_reporter.py

示例4: test_errors

# 需要导入模块: from doit.task import Task [as 别名]
# 或者: from doit.task.Task import execute [as 别名]
 def test_errors(self, reporter, dep_manager):
     def raise_something(x):
         raise Exception(x)
     t1 = Task('t1', [], teardown=[(raise_something,['t1 blow'])])
     t2 = Task('t2', [], teardown=[(raise_something,['t2 blow'])])
     my_runner = runner.Runner(dep_manager, reporter)
     my_runner.teardown_list = [t1, t2]
     t1.execute()
     t2.execute()
     my_runner.teardown()
     assert ('teardown', t2) == reporter.log.pop(0)
     assert ('cleanup_error',) == reporter.log.pop(0)
     assert ('teardown', t1) == reporter.log.pop(0)
     assert ('cleanup_error',) == reporter.log.pop(0)
     assert not reporter.log
开发者ID:barleyj,项目名称:doit,代码行数:17,代码来源:test_runner.py

示例5: test

# 需要导入模块: from doit.task import Task [as 别名]
# 或者: from doit.task.Task import execute [as 别名]
    def test(self):
        def sample():
            print("this is printed")

        t1 = Task("t1", [(sample,)])
        result = reporter.TaskResult(t1)
        result.start()
        t1.execute()
        result.set_result("success")
        got = result.to_dict()
        assert t1.name == got["name"], got
        assert "success" == got["result"], got
        assert "this is printed\n" == got["out"], got
        assert "" == got["err"], got
        assert got["started"]
        assert "elapsed" in got
开发者ID:cornell-brg,项目名称:doit,代码行数:18,代码来源:test_reporter.py

示例6: testSetVerbosity

# 需要导入模块: from doit.task import Task [as 别名]
# 或者: from doit.task.Task import execute [as 别名]
 def testSetVerbosity(self, depfile):
     output = StringIO.StringIO()
     t = Task('x', None)
     used_verbosity = []
     def my_execute(out, err, verbosity):
         used_verbosity.append(verbosity)
     t.execute = my_execute
     cmds.doit_run(depfile.name, [t], output, verbosity=2)
     assert 2 == used_verbosity[0], used_verbosity
开发者ID:SchuylerGoodman,项目名称:topicalguide,代码行数:11,代码来源:test_cmds.py

示例7: testSetVerbosity

# 需要导入模块: from doit.task import Task [as 别名]
# 或者: from doit.task.Task import execute [as 别名]
 def testSetVerbosity(self):
     remove_testdb()
     output = StringIO.StringIO()
     t = Task('x', None)
     used_verbosity = []
     def my_execute(out, err, verbosity):
         used_verbosity.append(verbosity)
     t.execute = my_execute
     cmds.doit_run(TESTDB, [t], output, verbosity=2)
     assert 2 == used_verbosity[0], used_verbosity
开发者ID:jergason,项目名称:topicalguide,代码行数:12,代码来源:test_cmds.py

示例8: testSetVerbosity

# 需要导入模块: from doit.task import Task [as 别名]
# 或者: from doit.task.Task import execute [as 别名]
 def testSetVerbosity(self, depfile):
     output = StringIO.StringIO()
     t = Task('x', None)
     used_verbosity = []
     def my_execute(out, err, verbosity):
         used_verbosity.append(verbosity)
     t.execute = my_execute
     cmd_run = Run(dep_file=depfile.name, task_list=[t])
     cmd_run._execute(output, verbosity=2)
     assert 2 == used_verbosity[0], used_verbosity
开发者ID:swayf,项目名称:doit,代码行数:12,代码来源:test_cmd_run.py

示例9: testSetVerbosity

# 需要导入模块: from doit.task import Task [as 别名]
# 或者: from doit.task.Task import execute [as 别名]
 def testSetVerbosity(self, depfile_name):
     output = StringIO()
     t = Task('x', None)
     used_verbosity = []
     def my_execute(out, err, verbosity):
         used_verbosity.append(verbosity)
     t.execute = my_execute
     cmd_run = CmdFactory(Run, backend='dbm', dep_file=depfile_name,
                          task_list=[t])
     cmd_run._execute(output, verbosity=2)
     assert 2 == used_verbosity[0], used_verbosity
开发者ID:JohannesBuchner,项目名称:doit,代码行数:13,代码来源:test_cmd_run.py


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