%! import os import posixpath # this must be posixpath, since we want /'s not \'s import re import six from six.moves import range from framework import grouptools, status def group_changes(test, current): group = grouptools.groupname(test) common = grouptools.commonprefix((current, group)) common = grouptools.split(common) open = grouptools.split(group)[len(common):] close = grouptools.split(current)[len(common):] return open, close def group_result(result, group): """Get the worst status in a group.""" if group not in result.totals: return status.NOTRUN return max([status.status_lookup(s) for s, v in six.iteritems(result.totals[group]) if v > 0]) def group_fraction(result, group): """Get the fraction value for a group.""" if group not in result.totals: return '0/0' num = 0 den = 0 for k, v in six.iteritems(result.totals[group]): if v > 0: s = status.status_lookup(k) num += s.fraction[0] * v den += s.fraction[1] * v return '{}/{}'.format(num, den) def escape_filename(key): """Avoid reserved characters in filenames.""" return re.sub(r'[<>:"|?*#]', '_', key) def escape_pathname(key): """ Remove / and \\ from names """ return re.sub(r'[/\\]', '_', key) def normalize_href(href): """Force backward slashes in URLs.""" return href.replace('\\', '/') %>
Currently showing: ${page}
Show: % if page == 'all': all % else: all % endif % for i in pages: % if i == page: | ${i} % else: | ${i} % endif % endfor
% for res in results.results: | ${res.name} \ (info) |
% endfor
---|---|
all | % for res in results.results:${group_fraction(res, 'root')} | % endfor
${elem}
|
## add each group's totals
% for res in results.results:
${group_fraction(res, group)} | % endfor <% depth += 1 %>
${grouptools.testname(test)}
|
% for res in results.results:
<%
# Get the raw result, if it's none check to see if it's a subtest, if that's still None
# then declare it not run
# This very intentionally uses posix path, we're generating urls, and while
# some windows based browsers support \\ as a url separator, *nix systems do not,
# which would make a result generated on windows non-portable
raw = res.tests.get(test)
if raw is not None:
result = raw.result
href = normalize_href(posixpath.join(escape_pathname(res.name),
escape_filename(test)))
else:
raw = res.tests.get(grouptools.groupname(test))
name = grouptools.testname(test)
if raw is not None and name in raw.subtests:
result = raw.subtests[name]
href = normalize_href(posixpath.join(escape_pathname(res.name),
escape_filename(grouptools.groupname(test))))
else:
result = status.NOTRUN
del raw # we don't need this, so don't let it leak
%>
% if str(result) not in exclude and result is not status.NOTRUN: ${str(result)} % else: ${str(result)} % endif | % endfor