Merge ~stanley31/bugit/+git/bugit:add-failed-tests into bugit:master

Proposed by StanleyHuang
Status: Merged
Approved by: StanleyHuang
Approved revision: 63a4a85236c184dca147d82bb86e181584f7c1bc
Merged at revision: 8492f321a87e84b9cd205fb931b6c55af5310754
Proposed branch: ~stanley31/bugit/+git/bugit:add-failed-tests
Merge into: bugit:master
Diff against target: 291 lines (+81/-40)
1 file modified
bugit/ui.py (+81/-40)
Reviewer Review Type Date Requested Status
HanhsuanLee Approve
Yujin.Wu Pending
Vincent Liao Pending
Gabriel Zhi Chen Pending
Vic Liu Pending
Scott Hu Pending
Clair Lin Pending
YANG, ZHI-HAO Pending
Rick Wu Pending
Weichen Wu Pending
PeiYao Chang Pending
Review via email: mp+466204@code.launchpad.net

Commit message

Add 'affected test cases' section in bug report

To post a comment you must log in.
Revision history for this message
HanhsuanLee (hanhsuan) wrote :

Does this change not be included in ReopenReportScreen ?

Revision history for this message
StanleyHuang (stanley31) wrote :

> Does this change not be included in ReopenReportScreen ?

The ReopenReportScreen will not modify the bug description, but add a comment. So user need to add the failed test cases in the description fields manually in current implementation.

Revision history for this message
HanhsuanLee (hanhsuan) wrote :

LGTM

Revision history for this message
HanhsuanLee (hanhsuan) wrote :

LGTM to approve

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/bugit/ui.py b/bugit/ui.py
2index 986621d..f6a1e08 100644
3--- a/bugit/ui.py
4+++ b/bugit/ui.py
5@@ -40,7 +40,9 @@ class SelectionScreen:
6 self.build_ui()
7
8 def build_ui(self):
9- button = urwid.Button(label="None", on_press=self.item_chosen, user_data="None")
10+ button = urwid.Button(
11+ label="None", on_press=self.item_chosen, user_data="None"
12+ )
13 _ui_items = [button]
14 self.header = urwid.AttrMap(urwid.Text(self._header_text), "header")
15 self.footer = urwid.AttrMap(urwid.Text(self.footer_text), "foot")
16@@ -55,7 +57,10 @@ class SelectionScreen:
17 self.main_view = urwid.Frame(
18 urwid.Filler(
19 urwid.Padding(
20- self.pile, align="center", width=("relative", 5), min_width=50
21+ self.pile,
22+ align="center",
23+ width=("relative", 5),
24+ min_width=50,
25 ),
26 "top",
27 ),
28@@ -92,8 +97,10 @@ class SessionsScreen(SelectionScreen):
29
30 header_text = (
31 "The following Checkbox sessions are available on this device.\n\n"
32- "You can select a failed job from one of these, and bugit will automatically get the output from this job.\n"
33- "Please select the Checkbox session to use (or 'None' if you want to fill the description yourself):\n\n"
34+ "You can select a failed job from one of these,"
35+ " and bugit will automatically get the output from this job.\n"
36+ "Please select the Checkbox session to use"
37+ " (or 'None' if you want to fill the description yourself):\n\n"
38 "(Note: the sessions are sorted with the most recent on top.)"
39 )
40 super().__init__(items=items, header_text=header_text)
41@@ -104,7 +111,8 @@ class JobsScreen(SelectionScreen):
42
43 header_text = (
44 "The following jobs are available in this session.\n\n"
45- "You can select a failed job from one of these, and bugit will automatically get the output from this job.\n"
46+ "You can select a failed job from one of these,"
47+ " and bugit will automatically get the output from this job.\n"
48 "Please select the job to use:\n\n"
49 )
50 super().__init__(items=items, header_text=header_text)
51@@ -128,10 +136,19 @@ class ReportScreen:
52
53 statuses = ("New", "Confirmed")
54 importances = {
55- 'launchpad': ("Undecided", "Wishlist", "Low", "Medium", "High", "Critical"),
56- 'jira': ("Lowest", "Low", "Medium", "High", "Highest")
57+ "launchpad": (
58+ "Undecided",
59+ "Wishlist",
60+ "Low",
61+ "Medium",
62+ "High",
63+ "Critical",
64+ ),
65+ "jira": ("Lowest", "Low", "Medium", "High", "Highest"),
66 }
67- STAGE_IMMEDIATE = "Issue reported and logs collected right after it happened"
68+ STAGE_IMMEDIATE = (
69+ "Issue reported and logs collected right after it happened"
70+ )
71 STAGE_FROZEN_DEVICE = (
72 "Device froze, issue reported and logs collected right after a reboot"
73 )
74@@ -167,10 +184,12 @@ class ReportScreen:
75 template="Launchpad",
76 ):
77 if job_id and job_output:
78+ self.default_description += f"[Affected test cases]\n{job_id}\n\n"
79 self.default_description += f"[Checkbox job `{job_id}` output]\n\n"
80 if job_output["comments"]:
81 self.default_description += (
82- "Tester comments\n---------------\n" f"{job_output['comments']}\n\n"
83+ "Tester comments\n---------------\n"
84+ f"{job_output['comments']}\n\n"
85 )
86 if not job_output["stdout"] and not job_output["stderr"]:
87 self.default_description += "No output found for this job.\n\n"
88@@ -182,17 +201,17 @@ class ReportScreen:
89 self.default_description += (
90 "stderr\n------\n" f"{job_output['stderr']}\n"
91 )
92+ else:
93+ self.default_description += "[Affected test cases]\n\n"
94
95 # Adding standard info (CPU, BIOS, GPU, etc.) to the description
96 std_info = AttachmentAssistant.get_standard_info()
97 std_info_str = "\n".join(
98 ["{}: {}".format(elt, std_info[elt]) for elt in std_info]
99 )
100- cid_str = "\nCID: {}".format(cid)
101- sku_str = "\nSKU: {}".format(sku)
102 self.default_description += (
103- "[Additional information]" + cid_str + sku_str + "\n" + std_info_str
104- )
105+ "[Additional information]\nCID: {}\nSKU: {}\n{}"
106+ ).format(cid, sku, std_info_str)
107
108 self._title = urwid.LineBox(urwid.Edit(), "Bug Title")
109 self._description = urwid.LineBox(
110@@ -233,7 +252,9 @@ class ReportScreen:
111 )
112 self._tags = urwid.LineBox(urwid.Edit(edit_text=tags), "Tags")
113 status_list = urwid.LineBox(urwid.Pile(self._status), "Status")
114- importance_list = urwid.LineBox(urwid.Pile(self._importance), "Importance")
115+ importance_list = urwid.LineBox(
116+ urwid.Pile(self._importance), "Importance"
117+ )
118 stage_bug_filed_list = urwid.LineBox(
119 urwid.Pile(self._stage_bug_filed), "When was the issue filed?"
120 )
121@@ -261,13 +282,19 @@ class ReportScreen:
122 self.bug_tags_lists,
123 ]
124 )
125- self.main_view = urwid.Frame(urwid.Filler(self.pile, "top"), footer=self.footer)
126+ self.main_view = urwid.Frame(
127+ urwid.Filler(self.pile, "top"), footer=self.footer
128+ )
129 self.error_text = urwid.Text("")
130 self.ok_button = urwid.Padding(
131- urwid.Button("OK", on_press=self.close_dialog), align="center", width=6
132+ urwid.Button("OK", on_press=self.close_dialog),
133+ align="center",
134+ width=6,
135 )
136 self.error_dialog = urwid.AttrMap(
137- urwid.LineBox(urwid.Pile([self.error_text, self.ok_button]), "Error"),
138+ urwid.LineBox(
139+ urwid.Pile([self.error_text, self.ok_button]), "Error"
140+ ),
141 "error",
142 )
143 self.error_view = urwid.Overlay(
144@@ -287,8 +314,8 @@ class ReportScreen:
145 else:
146 # if checkbox is unticked
147 for tag in tags:
148- self._tags.base_widget.edit_text = self._tags.base_widget.edit_text.replace(
149- tag, ""
150+ self._tags.base_widget.edit_text = (
151+ self._tags.base_widget.edit_text.replace(tag, "")
152 )
153 # clean up the list of tags to
154 # - remove unwanted white spaces
155@@ -338,7 +365,9 @@ class ReportScreen:
156 if "ihv-nvidia" in tags and any([i in tags for i in check_tags]):
157 options.update({"include_nvidia-bug-report": True})
158
159- stage_bug_filed = [rb.label for rb in self._stage_bug_filed if rb.state]
160+ stage_bug_filed = [
161+ rb.label for rb in self._stage_bug_filed if rb.state
162+ ]
163 if stage_bug_filed:
164 # If the bug description already contains a "[Stage]" section,
165 # remove it since it will be updated and re-filled below
166@@ -348,10 +377,14 @@ class ReportScreen:
167 description_list.pop(i) # Remove the [Stage] line
168 description_list.pop(i) # Remove the line after [Stage]
169 description = (
170- "\n".join(description_list) + "\n\n[Stage]\n" + stage_bug_filed[0]
171+ "\n".join(description_list)
172+ + "\n\n[Stage]\n"
173+ + stage_bug_filed[0]
174 )
175 self._description.base_widget.set_edit_text(description)
176- options["device_froze"] = self.STAGE_FROZEN_DEVICE in stage_bug_filed[0]
177+ options["device_froze"] = (
178+ self.STAGE_FROZEN_DEVICE in stage_bug_filed[0]
179+ )
180 options["collect_log"] = self.STAGE_LATER not in stage_bug_filed[0]
181
182 return BugReport(
183@@ -380,7 +413,7 @@ class ReopenReportScreen(ReportScreen):
184 importance="",
185 job_id="",
186 job_output=None,
187- template="Launchpad"
188+ template="Launchpad",
189 ):
190 if job_id and job_output:
191 job_pattern = ["comments", "stdout", "stderr"]
192@@ -390,11 +423,10 @@ class ReopenReportScreen(ReportScreen):
193 prefix_str = "Job {}".format(key)
194 self.default_description += "{}\n{}\n{}\n\n".format(
195 prefix_str,
196- '-'*len(prefix_str),
197- job_output[key].strip()
198+ "-" * len(prefix_str),
199+ job_output[key].strip(),
200 )
201- if not job_output["stdout"].strip() and \
202- not job_output["stderr"]:
203+ if not job_output["stdout"].strip() and not job_output["stderr"]:
204 self.default_description += "No output found for this job\n\n"
205
206 # Adding standard info (CPU, BIOS, GPU, etc.) to the description
207@@ -403,10 +435,7 @@ class ReopenReportScreen(ReportScreen):
208 ["{}: {}".format(elt, std_info[elt]) for elt in std_info]
209 )
210 self.default_description += (
211- "[Additional information]\n"
212- "CID: {}\n"
213- "SKU: {}\n"
214- "{}"
215+ "[Additional information]\nCID: {}\nSKU: {}\n{}"
216 ).format(cid, sku, std_info_str)
217
218 self._title = urwid.LineBox(urwid.Text(title), "Bug Title")
219@@ -423,8 +452,11 @@ class ReopenReportScreen(ReportScreen):
220 self._importance = []
221 for i in self.importances[template]:
222 rb = urwid.RadioButton(self._importance, i, "first True", None)
223- [rb.set_state(True) for rb in self._importance
224- if rb.label == importance]
225+ [
226+ rb.set_state(True)
227+ for rb in self._importance
228+ if rb.label == importance
229+ ]
230
231 self._stage_bug_filed = []
232 for s in self.stage_bug_filed:
233@@ -441,7 +473,7 @@ class ReopenReportScreen(ReportScreen):
234 bug_state_lists = urwid.Columns(
235 [
236 urwid.LineBox(urwid.Pile(self._status), "Status"),
237- urwid.LineBox(urwid.Pile(self._importance), "Importance")
238+ urwid.LineBox(urwid.Pile(self._importance), "Importance"),
239 ]
240 )
241
242@@ -457,15 +489,18 @@ class ReopenReportScreen(ReportScreen):
243 ]
244 )
245 self.main_view = urwid.Frame(
246- urwid.Filler(self.pile, "top"), footer=self.footer)
247+ urwid.Filler(self.pile, "top"), footer=self.footer
248+ )
249 self.error_text = urwid.Text("")
250 self.ok_button = urwid.Padding(
251 urwid.Button("OK", on_press=self.close_dialog),
252- align="center", width=6
253+ align="center",
254+ width=6,
255 )
256 self.error_dialog = urwid.AttrMap(
257 urwid.LineBox(
258- urwid.Pile([self.error_text, self.ok_button]), "Error"),
259+ urwid.Pile([self.error_text, self.ok_button]), "Error"
260+ ),
261 "error",
262 )
263 self.error_view = urwid.Overlay(
264@@ -480,7 +515,9 @@ class ReopenReportScreen(ReportScreen):
265 def report(self):
266 options = {}
267
268- stage_bug_filed = [rb.label for rb in self._stage_bug_filed if rb.state]
269+ stage_bug_filed = [
270+ rb.label for rb in self._stage_bug_filed if rb.state
271+ ]
272 if stage_bug_filed:
273 # If the bug description already contains a "[Stage]" section,
274 # remove it since it will be updated and re-filled below
275@@ -490,10 +527,14 @@ class ReopenReportScreen(ReportScreen):
276 description_list.pop(i) # Remove the [Stage] line
277 description_list.pop(i) # Remove the line after [Stage]
278 description = (
279- "\n".join(description_list) + "\n\n[Stage]\n" + stage_bug_filed[0]
280+ "\n".join(description_list)
281+ + "\n\n[Stage]\n"
282+ + stage_bug_filed[0]
283 )
284 self._description.base_widget.set_edit_text(description)
285- options["device_froze"] = self.STAGE_FROZEN_DEVICE in stage_bug_filed[0]
286+ options["device_froze"] = (
287+ self.STAGE_FROZEN_DEVICE in stage_bug_filed[0]
288+ )
289 options["collect_log"] = self.STAGE_LATER not in stage_bug_filed[0]
290
291 return BugReport(

Subscribers

People subscribed via source and target branches

to all changes: