本文整理汇总了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
示例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
示例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
示例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
示例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
示例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
示例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
示例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
示例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