本文整理汇总了Python中jenkinsapi.job.Job.get_build_by_params方法的典型用法代码示例。如果您正苦于以下问题:Python Job.get_build_by_params方法的具体用法?Python Job.get_build_by_params怎么用?Python Job.get_build_by_params使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jenkinsapi.job.Job
的用法示例。
在下文中一共展示了Job.get_build_by_params方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_build_by_params_not_found
# 需要导入模块: from jenkinsapi.job import Job [as 别名]
# 或者: from jenkinsapi.job.Job import get_build_by_params [as 别名]
def test_get_build_by_params_not_found(jenkins, monkeypatch, mocker):
build_params = {
'param1': 'value1'
}
fake_builds = (
mocker.Mock(get_params=lambda: {}),
mocker.Mock(get_params=lambda: {}),
mocker.Mock(get_params=lambda: {})
)
build_call_count = [0]
def fake_get_build(cls, number): # pylint: disable=unused-argument
build_call_count[0] += 1
return fake_builds[number - 1]
monkeypatch.setattr(Job, 'get_first_buildnumber', lambda x: 1)
monkeypatch.setattr(Job, 'get_last_buildnumber', lambda x: 3)
monkeypatch.setattr(Job, 'get_build', fake_get_build)
mocker.spy(Build, 'get_params')
mocker.spy(Job, 'get_build')
job = Job('http://localhost/jobs/foo', 'foo', jenkins)
with pytest.raises(NoBuildData):
job.get_build_by_params(build_params)
assert job.get_build.call_count == 3
assert build_call_count[0] == 3