[Piglit] [PATCH] framework: use formatted time values in the HTML report
Dylan Baker
baker.dylan.c at gmail.com
Mon Apr 28 13:41:01 PDT 2014
On Monday, April 28, 2014 11:56:52 Thomas Wood wrote:
> v2: update for the changes to the test result template and check for None
> in the summary index time value
>
> Signed-off-by: Thomas Wood <thomas.wood at intel.com>
> ---
> framework/summary.py | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/framework/summary.py b/framework/summary.py
> index 9228330..62e543f 100644
> --- a/framework/summary.py
> +++ b/framework/summary.py
> @@ -26,6 +26,7 @@ import itertools
> import shutil
> import collections
> import tempfile
> +from datetime import timedelta
Personally I prefer to keep the namespace, but it's just a suggestion
> from mako.template import Template
>
> # a local variable status exists, prevent accidental overloading by renaming
> @@ -383,9 +384,11 @@ class Summary:
> for each in self.results:
> os.mkdir(path.join(destination, each.name))
>
> + time = str(timedelta(0, each.time_elapsed)) if each.time_elapsed is not None else None
> +
Our python style is to keep the lines <= 79 characters when possible.
I'd do this:
if value.get('time'):
value['time'] = str(timedelta(0, value['time'])
> with open(path.join(destination, each.name, "index.html"), 'w') as out:
> out.write(testindex.render(name=each.name,
> - time=each.time_elapsed,
> + time=time,
> options=each.options,
> uname=each.uname,
> glxinfo=each.glxinfo,
> @@ -405,6 +408,8 @@ class Summary:
> if isinstance(value.get('dmesg'), list):
> value['dmesg'] = "\n".join(value['dmesg'])
>
> + value['time'] = str(timedelta(0, value.get('time'))) if value.get('time') is not None else None
> +
same comment as above
> with open(path.join(destination, each.name, key + ".html"),
> 'w') as out:
> out.write(testfile.render(
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20140428/9b3179a0/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20140428/9b3179a0/attachment-0001.sig>
More information about the Piglit
mailing list