From: salimfadhley Date: Fri, 5 Jul 2013 00:04:35 +0000 (+0100) Subject: build objects now have a get_console function X-Git-Tag: v0.2.23~116^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a01c18b7a9e7ce9e1bd6f6b6c7948cc9b268a08f;p=tools%2Fpython-jenkinsapi.git build objects now have a get_console function --- diff --git a/jenkinsapi/build.py b/jenkinsapi/build.py index 84db734..fa5c3ae 100644 --- a/jenkinsapi/build.py +++ b/jenkinsapi/build.py @@ -282,6 +282,13 @@ class Build(JenkinsBase): naive_timestamp = datetime.datetime(*time.gmtime(self._data['timestamp']/1000.0)[:6]) return pytz.utc.localize(naive_timestamp) + def get_console(self): + """ + Return the current state of the text console. + """ + url = "%s/consoleText" % self.baseurl + return self.job.jenkins.requester.get_url(url).content + def stop(self): """ Stops the build execution if it's running diff --git a/jenkinsapi_tests/systests/job_configs.py b/jenkinsapi_tests/systests/job_configs.py index 9d2d547..53de906 100644 --- a/jenkinsapi_tests/systests/job_configs.py +++ b/jenkinsapi_tests/systests/job_configs.py @@ -155,4 +155,4 @@ gzip < out.txt > out.gz -""".strip() \ No newline at end of file +""".strip() diff --git a/jenkinsapi_tests/systests/test_invocation.py b/jenkinsapi_tests/systests/test_invocation.py index f438353..fd4beef 100644 --- a/jenkinsapi_tests/systests/test_invocation.py +++ b/jenkinsapi_tests/systests/test_invocation.py @@ -31,6 +31,8 @@ class TestInvocation(BaseSystemTest): self.assertIsInstance(b, Build) ii.stop() self.assertFalse(ii.is_running()) + self.assertIsInstance(ii.get_build().get_console(), str) + self.assertIn('Building on master', ii.get_build().get_console()) def test_get_block_until_build_complete(self): job_name = 'create_%s' % random_string() diff --git a/jenkinsapi_tests/systests/test_parameterized_builds.py b/jenkinsapi_tests/systests/test_parameterized_builds.py index 7eead9d..3961930 100644 --- a/jenkinsapi_tests/systests/test_parameterized_builds.py +++ b/jenkinsapi_tests/systests/test_parameterized_builds.py @@ -70,5 +70,7 @@ class TestParameterizedBuilds(BaseSystemTest): artB = artifacts['b.txt'] self.assertTrue(artB.get_data().strip(), param_B) + self.assertIn(param_B, b.get_console()) + if __name__ == '__main__': unittest.main()