本文整理汇总了Python中pulp.bindings.responses.Task.task_id方法的典型用法代码示例。如果您正苦于以下问题:Python Task.task_id方法的具体用法?Python Task.task_id怎么用?Python Task.task_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pulp.bindings.responses.Task
的用法示例。
在下文中一共展示了Task.task_id方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_display_with_keyboard_interrupt
# 需要导入模块: from pulp.bindings.responses import Task [as 别名]
# 或者: from pulp.bindings.responses.Task import task_id [as 别名]
def test_display_with_keyboard_interrupt(self, mock_display):
# Setup
task_list = []
for i in range(0, 3):
task = Task(TASK_TEMPLATE)
task.task_id = 'task_%s' % i
task_list.append(task)
# Side effect to simulate keyboard interrupt
def interrupt(context, renderer, task_id, quiet_waiting=True):
if task_id == 'task_1':
raise KeyboardInterrupt()
else:
return task_id
mock_display.side_effect = interrupt
# Test
status._display_status(self.context, self.renderer, task_list)
# Verify
self.assertEqual(2, mock_display.call_count) # not called for the third task
for i, call_args in enumerate(mock_display.call_args_list):
self.assertEqual(call_args[0][0], self.context)
self.assertEqual(call_args[0][1], self.renderer)
self.assertEqual(call_args[0][2], 'task_%s' % i)
expected_quiet = i > 0
self.assertEqual(call_args[1]['quiet_waiting'], expected_quiet)
示例2: test_display_status
# 需要导入模块: from pulp.bindings.responses import Task [as 别名]
# 或者: from pulp.bindings.responses.Task import task_id [as 别名]
def test_display_status(self, mock_display):
# Setup
task_list = []
for i in range(0, 2):
task = Task(TASK_TEMPLATE)
task.task_id = 'task_%s' % i
task_list.append(task)
# Test
status._display_status(self.context, self.renderer, task_list)
# Verify
self.assertEqual(2, mock_display.call_count)
for i, call_args in enumerate(mock_display.call_args_list):
self.assertEqual(call_args[0][0], self.context)
self.assertEqual(call_args[0][1], self.renderer)
self.assertEqual(call_args[0][2], 'task_%s' % i)
expected_quiet = i > 0
self.assertEqual(call_args[1]['quiet_waiting'], expected_quiet)