Make gtester-report compatible with Python 3

Convert tabs to spaces and replace print with print().
The script still works with Python 2.x.

https://bugzilla.gnome.org/show_bug.cgi?id=696324
This commit is contained in:
Jan de Groot 2013-03-21 19:51:28 +00:00 committed by Jürg Billeter
parent 1c6e6671d1
commit 4d74ca4c3a

View File

@ -306,20 +306,20 @@ class HTMLReportWriter(ReportWriter):
if binary.success_cases:
oklink = 'href="javascript:toggle_display (\'ResultTable\', \'tr\', \'b%u_\', \'success\')"' % self.bcounter
if real_cases != 0:
self.oprint ('<a %s>ER</a>\n' % erlink)
self.oprint ('<a %s>OK</a>\n' % oklink)
self.oprint ('</td>\n')
perc = binary.success_cases * 100.0 / real_cases
pcolor = {
100 : 'bgcolor="lightgreen"',
0 : 'bgcolor="red"',
}.get (int (perc), 'bgcolor="yellow"')
self.oprint ('<td align="right" %s>%.2f%%</td>\n' % (pcolor, perc))
self.oprint ('</tr>\n')
self.oprint ('<a %s>ER</a>\n' % erlink)
self.oprint ('<a %s>OK</a>\n' % oklink)
self.oprint ('</td>\n')
perc = binary.success_cases * 100.0 / real_cases
pcolor = {
100 : 'bgcolor="lightgreen"',
0 : 'bgcolor="red"',
}.get (int (perc), 'bgcolor="yellow"')
self.oprint ('<td align="right" %s>%.2f%%</td>\n' % (pcolor, perc))
self.oprint ('</tr>\n')
else:
self.oprint ('Empty\n')
self.oprint ('</td>\n')
self.oprint ('</tr>\n')
self.oprint ('Empty\n')
self.oprint ('</td>\n')
self.oprint ('</tr>\n')
for tc in binary.testcases:
self.handle_testcase (tc, binary)
def handle_totals (self):
@ -464,7 +464,7 @@ def parse_opts():
" Needs python-subunit]")
options, files = parser.parse_args()
if options.version:
print parser.epilog
print(parser.epilog)
return None, None
if len(files) != 1:
parser.error("Must supply a log file to parse.")