Merge lp:~allanlesage/qa-coverage-dashboard/logging-only into lp:qa-coverage-dashboard

Proposed by Allan LeSage
Status: Merged
Approved by: Chris Gagnon
Approved revision: 767
Merged at revision: 767
Proposed branch: lp:~allanlesage/qa-coverage-dashboard/logging-only
Merge into: lp:qa-coverage-dashboard
Diff against target: 124 lines (+14/-16)
3 files modified
gaps/tests/test_jenkins_pull.py (+3/-4)
gaps/util/add.py (+3/-4)
gaps/util/jenkins_pull.py (+8/-8)
To merge this branch: bzr merge lp:~allanlesage/qa-coverage-dashboard/logging-only
Reviewer Review Type Date Requested Status
Chris Gagnon (community) Approve
Review via email: mp+216496@code.launchpad.net

Description of the change

Straightforwardly remove the prints.

To post a comment you must log in.
Revision history for this message
Chris Gagnon (chris.gagnon) wrote :

I don't think you meant to delete this

47 -from jenkinsapi import (
48 - #api,
49 - build,
50 - job,
51 -)

review: Needs Fixing
767. By Allan LeSage

Add imports to fix failing tests :/ .

Revision history for this message
Allan LeSage (allanlesage) wrote :

Deleted the above to satisfy flake8, corrected with proper import in test instead.

Revision history for this message
Chris Gagnon (chris.gagnon) wrote :

lgtm

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'gaps/tests/test_jenkins_pull.py'
2--- gaps/tests/test_jenkins_pull.py 2014-04-09 18:53:36 +0000
3+++ gaps/tests/test_jenkins_pull.py 2014-04-21 00:36:52 +0000
4@@ -6,11 +6,10 @@
5
6 from gaps.util.jenkins_pull import (
7 _get_artifact_urls,
8- build,
9 JenkinsAPIException,
10- job,
11 url_artifact_list,
12 )
13+from jenkinsapi import build, job
14 from jenkinsapi.api import Jenkins
15
16
17@@ -77,7 +76,7 @@
18 self.jenkinsapi_job_mock = MagicMock(
19 spec=job.Job)
20 jenkinsapi_job_patch = patch(
21- 'gaps.util.jenkins_pull.job.Job',
22+ 'jenkinsapi.job.Job',
23 new=self.jenkinsapi_job_mock)
24 jenkinsapi_job_patch.start()
25 self.addCleanup(jenkinsapi_job_patch.stop)
26@@ -85,7 +84,7 @@
27 self.jenkinsapi_build_mock = MagicMock(
28 spec=build.Build)
29 jenkinsapi_build_patch = patch(
30- 'gaps.util.jenkins_pull.job.Job',
31+ 'jenkinsapi.build.Build',
32 new=self.jenkinsapi_build_mock)
33 jenkinsapi_build_patch.start()
34 self.addCleanup(jenkinsapi_build_patch.stop)
35
36=== modified file 'gaps/util/add.py'
37--- gaps/util/add.py 2014-03-20 21:19:09 +0000
38+++ gaps/util/add.py 2014-04-21 00:36:52 +0000
39@@ -7,7 +7,6 @@
40 CoverageData,
41 CoverageProject,
42 CoverageStack,
43- StackCoverageObservation
44 )
45 from gaps.util import extractor, jenkins_pull
46
47@@ -22,7 +21,7 @@
48 :param jenkins_job_name: job to get artifacts from
49 :param file_name: file name of artifact
50 """
51- print("getting last_build")
52+ logger.debug("getting last_build")
53 last_build = [
54 j_build.coverage_build.build_number for j_build in
55 CoverageData.objects.filter(
56@@ -30,7 +29,7 @@
57 sorted(last_build)
58 if last_build == []:
59 last_build.append(0)
60- print("last build in our database is {}".format(last_build[-1]))
61+ logger.debug("last build in our database is {}".format(last_build[-1]))
62 url_list = jenkins_pull.url_artifact_list(
63 jenkins_job_name,
64 file_name,
65@@ -39,7 +38,7 @@
66
67 if url_list:
68 for build_info in url_list:
69- print('build info{}'.format(build_info))
70+ logger.debug('build info{}'.format(build_info))
71 if build_info['url'].endswith('xml'):
72 url_file = build_info['url']
73 url = '/'.join(build_info['url'].split('/')[:5])
74
75=== modified file 'gaps/util/jenkins_pull.py'
76--- gaps/util/jenkins_pull.py 2014-04-08 05:11:35 +0000
77+++ gaps/util/jenkins_pull.py 2014-04-21 00:36:52 +0000
78@@ -1,14 +1,13 @@
79
80+import logging
81 import time
82-from jenkinsapi import (
83- #api,
84- build,
85- job,
86-)
87+
88 from jenkinsapi.api import Jenkins
89 from jenkinsapi.custom_exceptions import JenkinsAPIException
90 from qa_dashboard.settings import JENKINS_URL
91
92+logger = logging.getLogger('qa_dashboard')
93+
94
95 def _get_artifact_urls(build, artifact_name):
96 """Return artifact urls from build
97@@ -47,7 +46,8 @@
98 try:
99 job = jenkapi.get_job(jenkins_job_name)
100 except:
101- print("job with name {} does not exist".format(jenkins_job_name))
102+ logger.debug(
103+ "job with name {} does not exist".format(jenkins_job_name))
104 return False
105 try:
106 build_ids = job.get_build_ids()
107@@ -68,7 +68,7 @@
108
109 if urls:
110 for url in urls:
111- print("adding url {}".format(url))
112+ logger.debug("adding url {}".format(url))
113 url_list.append({
114 'url': ''.join(url),
115 'build_id': id,
116@@ -80,7 +80,7 @@
117 'build_id': id,
118 'ran_at': ran_at
119 })
120- print url_list
121+ logger.debug(url_list)
122 if url_list:
123 return url_list
124 else:

Subscribers

People subscribed via source and target branches

to all changes: