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


Python job.Job类代码示例

本文整理汇总了Python中jenkinsapi.job.Job的典型用法代码示例。如果您正苦于以下问题:Python Job类的具体用法?Python Job怎么用?Python Job使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: test_nobuilds_get_last_build

    def test_nobuilds_get_last_build(self, _poll):
        # Bare minimum build dict, we only testing dissapearance of 'builds'
        _poll.return_value = {"name": "foo"}

        j = Job('http://halob:8080/job/foo/', 'foo', self.J)
        with self.assertRaises(NoBuildData):
            j.get_last_build()
开发者ID:TheFriendlyCoder,项目名称:jenkinsapi,代码行数:7,代码来源:test_job.py

示例2: test_get_build_by_params_not_found

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
开发者ID:PaleoWoods,项目名称:jenkinsapi,代码行数:29,代码来源:test_job.py

示例3: test_nobuilds_get_revision_dict

def test_nobuilds_get_revision_dict(jenkins, monkeypatch):
    def fake_poll(cls, tree=None):  # pylint: disable=unused-argument
        return {"name": "foo"}

    monkeypatch.setattr(Job, '_poll', fake_poll)
    job = Job('http://halob:8080/job/foo/', 'foo', jenkins)
    with pytest.raises(NoBuildData):
        job.get_revision_dict()
开发者ID:PaleoWoods,项目名称:jenkinsapi,代码行数:8,代码来源:test_job.py

示例4: disable

def disable(j, name):
  """
  disabled a job
  """
  job_url = "%s/job/%s" % (j.baseurl, name)
  job = Job(job_url, name, j)
  result = job.disable()  
  print("result: %s" % result.status_code)
开发者ID:makewhatis,项目名称:commons,代码行数:8,代码来源:jenkins.py

示例5: test_nobuilds_get_build_dict

    def test_nobuilds_get_build_dict(self):
        j = Job(
            'http://halob:8080/job/look_ma_no_builds/',
            'look_ma_no_builds',
            self.J)

        ret = j.get_build_dict()
        self.assertTrue(isinstance(ret, dict))
        self.assertEqual(len(ret), 0)
开发者ID:lechat,项目名称:jenkinsapi,代码行数:9,代码来源:test_job_get_all_builds.py

示例6: test_empty_field__add_missing_builds

 def test_empty_field__add_missing_builds(self, get_data):
     url = "http://halob:8080/job/foo/%s" % config.JENKINS_API
     data = TestJob.URL_DATA[url].copy()
     data.update({"firstBuild": None})
     get_data.return_value = data
     j = Job("http://halob:8080/job/foo/", "foo", self.J)
     initial_call_count = get_data.call_count
     j._add_missing_builds(data)
     self.assertEquals(get_data.call_count, initial_call_count)
开发者ID:henriklynggaard,项目名称:jenkinsapi,代码行数:9,代码来源:test_job.py

示例7: test__add_missing_builds_no_builds

 def test__add_missing_builds_no_builds(self, get_data):
     url = 'http://halob:8080/job/foo/%s' % config.JENKINS_API
     data = TestJob.URL_DATA[url].copy()
     get_data.return_value = data
     j = Job('http://halob:8080/job/foo/', 'foo', self.J)
     initial_call_count = get_data.call_count
     mock_data = TestJob.URL_DATA[url].copy()
     mock_data['builds'] = None
     j._add_missing_builds(mock_data)
     self.assertEquals(initial_call_count, get_data.call_count)
开发者ID:Khan,项目名称:jenkinsapi,代码行数:10,代码来源:test_job.py

示例8: test_get_params_list

    def test_get_params_list(self, get_data):
        url = 'http://halob:8080/job/foo/%s' % config.JENKINS_API
        get_data.return_value = TestJob.URL_DATA[url].copy()
        j = Job('http://halob:8080/job/foo/', 'foo', self.J)

        params = j.get_params_list()

        self.assertIsInstance(params, list)
        self.assertEquals(len(params), 2)
        self.assertEquals(params, ['param1', 'param2'])
开发者ID:naphthalene,项目名称:jenkinsapi,代码行数:10,代码来源:test_job.py

示例9: test__add_missing_builds_no_first_build

 def test__add_missing_builds_no_first_build(self, get_data):
     url = "http://halob:8080/job/foo/%s" % config.JENKINS_API
     data = TestJob.URL_DATA[url].copy()
     get_data.return_value = data
     j = Job("http://halob:8080/job/foo/", "foo", self.J)
     initial_call_count = get_data.call_count
     mock_data = TestJob.URL_DATA[url].copy()
     mock_data["firstBuild"] = None
     j._add_missing_builds(mock_data)
     self.assertEquals(initial_call_count, get_data.call_count)
开发者ID:baijum,项目名称:jenkinsapi,代码行数:10,代码来源:test_job.py

示例10: iterkeys

 def iterkeys(self):
     """
     Iterate over the names of all available jobs
     """
     if not self._data:
         self._data = self.poll().get('jobs', [])
     for row in self._data:
         yield row['name']
         if row['name'] != \
             Job.get_full_name_from_url_and_baseurl(row['url'],
                                                    self.jenkins.baseurl):
             yield Job.get_full_name_from_url_and_baseurl(
                 row['url'], self.jenkins.baseurl)
开发者ID:lechat,项目名称:jenkinsapi,代码行数:13,代码来源:jobs.py

示例11: getLastBuildInfo

 def getLastBuildInfo(self,server):
     try: 
         job_obj=Job(server.baseurl+"/job/"+self.data['builddf']['Name'],self.data['builddf']['Name'],server)
         last_bd=job_obj.get_last_build_or_none()
         self.logger.debug("The last build at %s is %s" % (server.baseurl, last_bd.name))
     except Exception, details:
         #sys.stderr.write('ERROR: %s \n' % details)
         #sys.exit(1)
         #x=inspect.stack()
         if 'test_' in inspect.stack()[1][3] or 'test_' in inspect.stack()[2][3]:
             raise
         else:
             #print Exception,details
             self.logger.error('ERROR: %s \n' % details,exc_info=True)
             sys.exit(1)
开发者ID:rayjiang2013,项目名称:RA,代码行数:15,代码来源:jenkinsNotifier.py

示例12: aget_job

    def aget_job(self, name):
        self.load()
        url = self.rest.job(name)
        try:
            data = yield from url.api.python.aget()
        except aiohttp.errors.HttpProcessingError as e:
            if 404 == e.code:
                raise UnknownJob()
            raise

        instance = JenkinsJob(data['url'], data['name'], self._instance)
        instance._data = data
        payload = yield from url('config.xml').aget()
        instance._config = payload.data
        return Job.factory(instance)
开发者ID:novafloss,项目名称:jenkins-github-poller,代码行数:15,代码来源:jenkins.py

示例13: test_incomplete_builds_list_will_call_jenkins_twice

 def test_incomplete_builds_list_will_call_jenkins_twice(self):
     # The job data contains only one build, so we expect that the
     # remaining jobs will be fetched automatically, and to have two calls
     # to the Jenkins API
     TestJobGetAllBuilds.__get_data_call_count = 0
     self.j = Job('http://halob:8080/job/foo/', 'foo', self.J)
     self.assertEqual(TestJobGetAllBuilds.__get_data_call_count, 2)
开发者ID:PaleoWoods,项目名称:jenkinsapi,代码行数:7,代码来源:test_job_get_all_builds.py

示例14: test__add_missing_builds_not_all_loaded

 def test__add_missing_builds_not_all_loaded(self, get_data):
     url = 'http://halob:8080/job/foo/%s' % config.JENKINS_API
     data = TestJob.URL_DATA[url].copy()
     get_data.return_value = data
     j = Job('http://halob:8080/job/foo/', 'foo', self.J)
     # to test this function we change data to not have one build
     # and set it to mark that firstBuild was not loaded
     # in that condition function will call j.get_data
     # and will use syntetic field 'allBuilds' to
     # repopulate 'builds' field with all builds
     mock_data = TestJob.URL_DATA[url].copy()
     mock_data['firstBuild'] = {'number': 1}
     del mock_data['builds'][-1]
     self.assertEquals(len(mock_data['builds']), 2)
     new_data = j._add_missing_builds(mock_data)
     self.assertEquals(len(new_data['builds']), 3)
开发者ID:Khan,项目名称:jenkinsapi,代码行数:16,代码来源:test_job.py

示例15: test_get_json_for_single_param

 def test_get_json_for_single_param(self):
     params = {"B": "one two three"}
     expected = '{"parameter": {"name": "B", "value": "one two three"}, "statusCode": "303", "redirectTo": "."}'
     self.assertJsonEqual(
         Job.mk_json_from_build_parameters(params),
         expected
     )
开发者ID:Khan,项目名称:jenkinsapi,代码行数:7,代码来源:test_job.py


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