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


Python SessionState.add_job方法代码示例

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


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

示例1: test_add_job

# 需要导入模块: from plainbox.impl.session import SessionState [as 别名]
# 或者: from plainbox.impl.session.SessionState import add_job [as 别名]
 def test_add_job(self):
     # Define a job
     job = make_job("A")
     # Define an empty session
     session = SessionState([])
     # Add the job to the session
     session.add_job(job)
     # The job got added to job list
     self.assertIn(job, session.job_list)
     # The job got added to job state map
     self.assertIs(session.job_state_map[job.name].job, job)
     # The job is not added to the desired job list
     self.assertNotIn(job, session.desired_job_list)
     # The job is not in the run list
     self.assertNotIn(job, session.run_list)
     # The job is not selected to run
     self.assertEqual(
         session.job_state_map[job.name].readiness_inhibitor_list,
         [UndesiredJobReadinessInhibitor])
开发者ID:jds2001,项目名称:ocp-checkbox,代码行数:21,代码来源:test_state.py

示例2: test_add_job_duplicate_job

# 需要导入模块: from plainbox.impl.session import SessionState [as 别名]
# 或者: from plainbox.impl.session.SessionState import add_job [as 别名]
 def test_add_job_duplicate_job(self):
     # Define a job
     job = make_job("A")
     # Define an empty session
     session = SessionState([])
     # Add the job to the session
     session.add_job(job)
     # The job got added to job list
     self.assertIn(job, session.job_list)
     # Define a perfectly identical job
     duplicate_job = make_job("A")
     self.assertEqual(job, duplicate_job)
     # Try adding it to the session
     #
     # Note that this does not raise any exceptions as the jobs are perfect
     # duplicates.
     session.add_job(duplicate_job)
     # The new job _did not_ get added to the job list
     self.assertEqual(len(session.job_list), 1)
     self.assertIsNot(duplicate_job, session.job_list[0])
开发者ID:jds2001,项目名称:ocp-checkbox,代码行数:22,代码来源:test_state.py

示例3: test_add_job_clashing_job

# 需要导入模块: from plainbox.impl.session import SessionState [as 别名]
# 或者: from plainbox.impl.session.SessionState import add_job [as 别名]
 def test_add_job_clashing_job(self):
     # Define a job
     job = make_job("A")
     # Define an empty session
     session = SessionState([])
     # Add the job to the session
     session.add_job(job)
     # The job got added to job list
     self.assertIn(job, session.job_list)
     # Define a different job that clashes with the initial job
     clashing_job = make_job("A", plugin='other')
     self.assertNotEqual(job, clashing_job)
     self.assertEqual(job.name, clashing_job.name)
     # Try adding it to the session
     #
     # This raises an exception
     with self.assertRaises(DependencyDuplicateError) as call:
         session.add_job(clashing_job)
     # The exception gets job in the right order
     self.assertIs(call.exception.affected_job, job)
     self.assertIs(call.exception.affecting_job, clashing_job)
     # The new job _did not_ get added to the job list
     self.assertEqual(len(session.job_list), 1)
     self.assertIsNot(clashing_job, session.job_list[0])
开发者ID:jds2001,项目名称:ocp-checkbox,代码行数:26,代码来源:test_state.py


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