Merge pull request #12667 from cv3d:fix/ts_report
TS: fix Python v2/v3 compatibility (#12667) * TS: fix Python2.7 compatibility * TS: fix Python3 compatibility * py3: use integer division '/' => '//' instead of cast
This commit is contained in:
parent
8f2eb60719
commit
1059735bfb
@ -66,7 +66,7 @@ if __name__ == "__main__":
|
|||||||
tbl.newColumn(m, metrix_table[m][0], align = "center")
|
tbl.newColumn(m, metrix_table[m][0], align = "center")
|
||||||
|
|
||||||
needNewRow = True
|
needNewRow = True
|
||||||
for case in sorted(tests):
|
for case in sorted(tests, key=lambda x: str(x)):
|
||||||
if needNewRow:
|
if needNewRow:
|
||||||
tbl.newRow()
|
tbl.newRow()
|
||||||
if not options.showall:
|
if not options.showall:
|
||||||
|
|||||||
@ -177,7 +177,7 @@ if __name__ == "__main__":
|
|||||||
prevGroupName = None
|
prevGroupName = None
|
||||||
needNewRow = True
|
needNewRow = True
|
||||||
lastRow = None
|
lastRow = None
|
||||||
for name in sorted(test_cases.iterkeys(), key=alphanum_keyselector):
|
for name in sorted(test_cases.keys(), key=alphanum_keyselector):
|
||||||
cases = test_cases[name]
|
cases = test_cases[name]
|
||||||
if needNewRow:
|
if needNewRow:
|
||||||
lastRow = tbl.newRow()
|
lastRow = tbl.newRow()
|
||||||
|
|||||||
@ -98,7 +98,7 @@ class table(object):
|
|||||||
|
|
||||||
def layoutTable(self):
|
def layoutTable(self):
|
||||||
columns = self.columns.values()
|
columns = self.columns.values()
|
||||||
columns.sort(key=lambda c: c.index)
|
columns = sorted(columns, key=lambda c: c.index)
|
||||||
|
|
||||||
colspanned = []
|
colspanned = []
|
||||||
rowspanned = []
|
rowspanned = []
|
||||||
@ -206,7 +206,7 @@ class table(object):
|
|||||||
cell.width = len(max(cell.text, key = lambda line: len(line)))
|
cell.width = len(max(cell.text, key = lambda line: len(line)))
|
||||||
|
|
||||||
def reformatTextValue(self, value):
|
def reformatTextValue(self, value):
|
||||||
if sys.version_info > (3,): # PY3 fix
|
if sys.version_info >= (2,7):
|
||||||
unicode = str
|
unicode = str
|
||||||
if isinstance(value, str):
|
if isinstance(value, str):
|
||||||
vstr = value
|
vstr = value
|
||||||
@ -340,7 +340,7 @@ class table(object):
|
|||||||
if align == "right":
|
if align == "right":
|
||||||
pattern = "%" + str(width) + "s"
|
pattern = "%" + str(width) + "s"
|
||||||
elif align == "center":
|
elif align == "center":
|
||||||
pattern = "%" + str((width - len(line)) / 2 + len(line)) + "s" + " " * (width - len(line) - (width - len(line)) / 2)
|
pattern = "%" + str((width - len(line)) // 2 + len(line)) + "s" + " " * (width - len(line) - (width - len(line)) // 2)
|
||||||
else:
|
else:
|
||||||
pattern = "%-" + str(width) + "s"
|
pattern = "%-" + str(width) + "s"
|
||||||
|
|
||||||
@ -354,7 +354,7 @@ class table(object):
|
|||||||
if valign == "bottom":
|
if valign == "bottom":
|
||||||
return height - space
|
return height - space
|
||||||
if valign == "middle":
|
if valign == "middle":
|
||||||
return (height - space + 1) / 2
|
return (height - space + 1) // 2
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
def htmlPrintTable(self, out, embeedcss = False):
|
def htmlPrintTable(self, out, embeedcss = False):
|
||||||
|
|||||||
@ -202,7 +202,7 @@ def parseLogFile(filename):
|
|||||||
if attr_name.startswith('cv_')
|
if attr_name.startswith('cv_')
|
||||||
}
|
}
|
||||||
|
|
||||||
tests = map(TestInfo, log.getElementsByTagName("testcase"))
|
tests = list(map(TestInfo, log.getElementsByTagName("testcase")))
|
||||||
|
|
||||||
return TestRunInfo(properties, tests)
|
return TestRunInfo(properties, tests)
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user