Merge lp:~sylvain-pineau/checkbox/xlsx_expoter_fixes into lp:checkbox

Proposed by Sylvain Pineau
Status: Merged
Approved by: Sylvain Pineau
Approved revision: 3023
Merged at revision: 3019
Proposed branch: lp:~sylvain-pineau/checkbox/xlsx_expoter_fixes
Merge into: lp:checkbox
Prerequisite: lp:~sylvain-pineau/checkbox/job_summary_for_exporters
Diff against target: 167 lines (+30/-22)
1 file modified
plainbox/plainbox/impl/exporter/xlsx.py (+30/-22)
To merge this branch: bzr merge lp:~sylvain-pineau/checkbox/xlsx_expoter_fixes
Reviewer Review Type Date Requested Status
Zygmunt Krynicki (community) Approve
Review via email: mp+220409@code.launchpad.net

Description of the change

Set of fixes for the xlsx exporter to render correctly under LibreOffice when started from checkbox-gui (i.e pre-run local jobs are now ignored)

To post a comment you must log in.
Revision history for this message
Zygmunt Krynicki (zyga) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'plainbox/plainbox/impl/exporter/xlsx.py'
--- plainbox/plainbox/impl/exporter/xlsx.py 2014-04-30 20:32:46 +0000
+++ plainbox/plainbox/impl/exporter/xlsx.py 2014-05-21 10:46:32 +0000
@@ -112,17 +112,17 @@
112 })112 })
113 # Titles + borders113 # Titles + borders
114 self.format04 = self.workbook.add_format({114 self.format04 = self.workbook.add_format({
115 'align': 'left', 'size': 12, 'bold': 1, 'border': 7115 'align': 'left', 'size': 12, 'bold': 1, 'border': 1
116 })116 })
117 # System info with borders117 # System info with borders
118 self.format05 = self.workbook.add_format({118 self.format05 = self.workbook.add_format({
119 'align': 'left', 'valign': 'vcenter', 'text_wrap': 1, 'size': 8,119 'align': 'left', 'valign': 'vcenter', 'text_wrap': 1, 'size': 8,
120 'border': 7,120 'border': 1,
121 })121 })
122 # System info with borders, grayed out background122 # System info with borders, grayed out background
123 self.format06 = self.workbook.add_format({123 self.format06 = self.workbook.add_format({
124 'align': 'left', 'valign': 'vcenter', 'text_wrap': 1, 'size': 8,124 'align': 'left', 'valign': 'vcenter', 'text_wrap': 1, 'size': 8,
125 'border': 7, 'bg_color': '#E6E6E6',125 'border': 1, 'bg_color': '#E6E6E6',
126 })126 })
127 # Headlines (center)127 # Headlines (center)
128 self.format07 = self.workbook.add_format({128 self.format07 = self.workbook.add_format({
@@ -140,17 +140,17 @@
140 # Green background / Size 8140 # Green background / Size 8
141 self.format10 = self.workbook.add_format({141 self.format10 = self.workbook.add_format({
142 'align': 'center', 'valign': 'vcenter', 'text_wrap': 1, 'size': 8,142 'align': 'center', 'valign': 'vcenter', 'text_wrap': 1, 'size': 8,
143 'bg_color': 'lime', 'border': 7, 'border_color': 'white',143 'bg_color': 'lime', 'border': 1, 'border_color': 'white',
144 })144 })
145 # Red background / Size 8145 # Red background / Size 8
146 self.format11 = self.workbook.add_format({146 self.format11 = self.workbook.add_format({
147 'align': 'center', 'valign': 'vcenter', 'text_wrap': 1, 'size': 8,147 'align': 'center', 'valign': 'vcenter', 'text_wrap': 1, 'size': 8,
148 'bg_color': 'red', 'border': 7, 'border_color': 'white',148 'bg_color': 'red', 'border': 1, 'border_color': 'white',
149 })149 })
150 # Gray background / Size 8150 # Gray background / Size 8
151 self.format12 = self.workbook.add_format({151 self.format12 = self.workbook.add_format({
152 'align': 'center', 'valign': 'vcenter', 'text_wrap': 1, 'size': 8,152 'align': 'center', 'valign': 'vcenter', 'text_wrap': 1, 'size': 8,
153 'bg_color': 'gray', 'border': 7, 'border_color': 'white',153 'bg_color': 'gray', 'border': 1, 'border_color': 'white',
154 })154 })
155 # Attachments155 # Attachments
156 self.format13 = self.workbook.add_format({156 self.format13 = self.workbook.add_format({
@@ -312,7 +312,8 @@
312 self.worksheet2.write(5, 1, '✘', self.format11)312 self.worksheet2.write(5, 1, '✘', self.format11)
313 self.worksheet2.write(313 self.worksheet2.write(
314 5, 2, (314 5, 2, (
315 ngettext('{} Test failed', '{} Tests failed', self.total_fail)315 ngettext('{} Test failed', '{} Tests failed',
316 self.total_fail).format(self.total_fail)
316 + ' - '317 + ' - '
317 + _('Failure Rate: {:.2f}% ({}/{})').format(318 + _('Failure Rate: {:.2f}% ({}/{})').format(
318 self.total_fail / self.total * 100,319 self.total_fail / self.total * 100,
@@ -322,7 +323,7 @@
322 self.worksheet2.write(323 self.worksheet2.write(
323 6, 2, (324 6, 2, (
324 ngettext('{} Test skipped', '{} Tests skipped',325 ngettext('{} Test skipped', '{} Tests skipped',
325 self.total_skip)326 self.total_skip).format(self.total_skip)
326 + ' - '327 + ' - '
327 + _('Skip Rate: {:.2f}% ({}/{})').format(328 + _('Skip Rate: {:.2f}% ({}/{})').format(
328 self.total_skip / self.total * 100,329 self.total_skip / self.total * 100,
@@ -347,7 +348,7 @@
347 )348 )
348 # Insert the chart into the worksheet.349 # Insert the chart into the worksheet.
349 self.worksheet2.insert_chart('F4', chart, {350 self.worksheet2.insert_chart('F4', chart, {
350 'x_offset': 0, 'y_offset': 10, 'x_scale': 0.25, 'y_scale': 0.25351 'x_offset': 0, 'y_offset': 10, 'x_scale': 0.50, 'y_scale': 0.50
351 })352 })
352353
353 def _set_category_status(self, result_map, via, child):354 def _set_category_status(self, result_map, via, child):
@@ -357,6 +358,9 @@
357 child_status = result_map[child]['outcome']358 child_status = result_map[child]['outcome']
358 if 'category_status' in result_map[child]:359 if 'category_status' in result_map[child]:
359 child_status = result_map[child]['category_status']360 child_status = result_map[child]['category_status']
361 # Ignore categories without any child
362 elif result_map[child]['plugin'] == 'local':
363 continue
360 if child_status == IJobResult.OUTCOME_FAIL:364 if child_status == IJobResult.OUTCOME_FAIL:
361 result_map[parent]['category_status'] = IJobResult.OUTCOME_FAIL365 result_map[parent]['category_status'] = IJobResult.OUTCOME_FAIL
362 elif (366 elif (
@@ -395,11 +399,14 @@
395 sorted(399 sorted(
396 tree.items(),400 tree.items(),
397 key=lambda t: 'z' + t[0] if t[1] else 'a' + t[0])).items():401 key=lambda t: 'z' + t[0] if t[1] else 'a' + t[0])).items():
402 if (result_map[job]['plugin'] == 'local' and
403 not result_map[job].get('category_status')):
404 continue
398 self._lineno += 1405 self._lineno += 1
399 if children:406 if children:
400 self.worksheet3.write(407 self.worksheet3.write(
401 self._lineno, level + 1,408 self._lineno, level + 1,
402 result_map[job]['description'], self.format15)409 result_map[job]['summary'], self.format15)
403 if (410 if (
404 result_map[job]['category_status'] ==411 result_map[job]['category_status'] ==
405 IJobResult.OUTCOME_PASS412 IJobResult.OUTCOME_PASS
@@ -435,7 +442,7 @@
435 self._write_job(children, result_map, max_level, level + 1)442 self._write_job(children, result_map, max_level, level + 1)
436 else:443 else:
437 self.worksheet3.write(444 self.worksheet3.write(
438 self._lineno, max_level + 1, job,445 self._lineno, max_level + 1, result_map[job]['summary'],
439 self.format08 if self._lineno % 2 else self.format09)446 self.format08 if self._lineno % 2 else self.format09)
440 if self.OPTION_WITH_DESCRIPTION in self._option_list:447 if self.OPTION_WITH_DESCRIPTION in self._option_list:
441 link_cell = xl_rowcol_to_cell(self._lineno, max_level + 1)448 link_cell = xl_rowcol_to_cell(self._lineno, max_level + 1)
@@ -443,9 +450,10 @@
443 self._lineno, max_level + 1,450 self._lineno, max_level + 1,
444 'internal:' + _("Test Descriptions") + '!' + link_cell,451 'internal:' + _("Test Descriptions") + '!' + link_cell,
445 self.format08 if self._lineno % 2 else self.format09,452 self.format08 if self._lineno % 2 else self.format09,
446 job)453 result_map[job]['summary'])
447 self.worksheet4.write(454 self.worksheet4.write(
448 self._lineno, max_level + 1, job,455 self._lineno, max_level + 1,
456 result_map[job]['summary'],
449 self.format08 if self._lineno % 2 else self.format09)457 self.format08 if self._lineno % 2 else self.format09)
450 self.total += 1458 self.total += 1
451 if result_map[job]['outcome'] == IJobResult.OUTCOME_PASS:459 if result_map[job]['outcome'] == IJobResult.OUTCOME_PASS:
@@ -498,17 +506,17 @@
498 self.format16 if self._lineno % 2 else self.format17)506 self.format16 if self._lineno % 2 else self.format17)
499 if level:507 if level:
500 self.worksheet3.set_row(508 self.worksheet3.set_row(
501 self._lineno, 12 + 9.71 * io_lines,509 self._lineno, 12 + 10.5 * io_lines,
502 None, {'level': level})510 None, {'level': level})
503 if self.OPTION_WITH_DESCRIPTION in self._option_list:511 if self.OPTION_WITH_DESCRIPTION in self._option_list:
504 self.worksheet4.set_row(512 self.worksheet4.set_row(
505 self._lineno, 12 + 9.71 * desc_lines,513 self._lineno, 12 + 10.5 * desc_lines,
506 None, {'level': level})514 None, {'level': level})
507 else:515 else:
508 self.worksheet3.set_row(self._lineno, 12 + 9.71 * io_lines)516 self.worksheet3.set_row(self._lineno, 12 + 10.5 * io_lines)
509 if self.OPTION_WITH_DESCRIPTION in self._option_list:517 if self.OPTION_WITH_DESCRIPTION in self._option_list:
510 self.worksheet4.set_row(518 self.worksheet4.set_row(
511 self._lineno, 12 + 9.71 * desc_lines)519 self._lineno, 12 + 10.5 * desc_lines)
512520
513 def write_results(self, data):521 def write_results(self, data):
514 tree, max_level = self._tree(data['result_map'])522 tree, max_level = self._tree(data['result_map'])
@@ -517,9 +525,9 @@
517 self.worksheet3.set_tab_color('#DC4C00') # Orange525 self.worksheet3.set_tab_color('#DC4C00') # Orange
518 self.worksheet3.set_column(0, 0, 5)526 self.worksheet3.set_column(0, 0, 5)
519 [self.worksheet3.set_column(i, i, 2) for i in range(1, max_level + 1)]527 [self.worksheet3.set_column(i, i, 2) for i in range(1, max_level + 1)]
520 self.worksheet3.set_column(max_level + 1, max_level + 0, 48)528 self.worksheet3.set_column(max_level + 1, max_level + 1, 48)
521 self.worksheet3.set_column(max_level + 2, max_level + 1, 12)529 self.worksheet3.set_column(max_level + 2, max_level + 2, 12)
522 self.worksheet3.set_column(max_level + 3, max_level + 2, 65)530 self.worksheet3.set_column(max_level + 3, max_level + 3, 65)
523 self.worksheet3.write_row(531 self.worksheet3.write_row(
524 5, max_level + 1, [_('Name'), _('Result'), _('I/O Log')],532 5, max_level + 1, [_('Name'), _('Result'), _('I/O Log')],
525 self.format07)533 self.format07)
@@ -529,8 +537,8 @@
529 self.worksheet4.set_column(0, 0, 5)537 self.worksheet4.set_column(0, 0, 5)
530 [self.worksheet4.set_column(i, i, 2)538 [self.worksheet4.set_column(i, i, 2)
531 for i in range(1, max_level + 1)]539 for i in range(1, max_level + 1)]
532 self.worksheet4.set_column(max_level + 1, max_level + 0, 48)540 self.worksheet4.set_column(max_level + 1, max_level + 1, 48)
533 self.worksheet4.set_column(max_level + 2, max_level + 1, 65)541 self.worksheet4.set_column(max_level + 2, max_level + 2, 65)
534 self.worksheet4.write_row(542 self.worksheet4.write_row(
535 5, max_level + 1, [_('Name'), _('Description')], self.format07543 5, max_level + 1, [_('Name'), _('Description')], self.format07
536 )544 )

Subscribers

People subscribed via source and target branches