From: Aleksey Maksimov Date: Sun, 18 Aug 2013 15:21:08 +0000 (+0800) Subject: Fixed last build number in invocation X-Git-Tag: v0.2.23~102^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=46c5286d3be7019fb3e150621a8fa1b0cebfa9bc;p=tools%2Fpython-jenkinsapi.git Fixed last build number in invocation --- diff --git a/jenkinsapi/invocation.py b/jenkinsapi/invocation.py index 6ab1800..7b83419 100644 --- a/jenkinsapi/invocation.py +++ b/jenkinsapi/invocation.py @@ -47,9 +47,7 @@ class Invocation(object): """ If this job is building or complete then provide it's build-number """ - # print '\nDEBUG: job.get_last_build_or_none=', self.job.get_last_build_or_none() - if not self.job.is_queued_or_running(): - self.build_number = self.job.get_last_buildnumber() + self.build_number = self.job.get_last_buildnumber() return self.build_number def get_build(self): diff --git a/jenkinsapi_tests/systests/test_invocation.py b/jenkinsapi_tests/systests/test_invocation.py index 0e220fe..b4b12cd 100644 --- a/jenkinsapi_tests/systests/test_invocation.py +++ b/jenkinsapi_tests/systests/test_invocation.py @@ -15,7 +15,7 @@ class TestInvocation(BaseSystemTest): def test_invocation_object(self): job_name = 'create_%s' % random_string() job = self.jenkins.create_job(job_name, LONG_RUNNING_JOB) - ii = job.invoke() + ii = job.invoke(invoke_pre_check_delay=7) self.assertIsInstance(ii, Invocation) self.assertTrue(ii.is_queued_or_running()) self.assertEquals(ii.get_build_number(), 1) @@ -23,7 +23,7 @@ class TestInvocation(BaseSystemTest): def test_get_block_until_build_running(self): job_name = 'create_%s' % random_string() job = self.jenkins.create_job(job_name, LONG_RUNNING_JOB) - ii = job.invoke() + ii = job.invoke(invoke_pre_check_delay=7) bn = ii.get_build_number() self.assertIsInstance(bn, int) ii.block(until='not_queued') @@ -45,13 +45,13 @@ class TestInvocation(BaseSystemTest): def test_multiple_invocations_and_get_last_build(self): job_name = 'create_%s' % random_string() - job = self.jenkins.create_job(job_name, EMPTY_JOB) + job = self.jenkins.create_job(job_name, SHORTISH_JOB) for _ in range(3): ii = job.invoke() ii.block(until='completed') - build_number = job.get_last_buildnumber() + build_number = job.get_last_good_buildnumber() self.assertEquals(build_number, 3) build = job.get_build(build_number)