[Piglit] [PATCH 1/2] framework: use formatted time values in the HTML report

Dylan Baker baker.dylan.c at gmail.com
Mon Feb 24 09:37:59 PST 2014


I have a bunch of style nits for you.

On Monday, February 24, 2014 04:56:58 PM Thomas Wood wrote:
> Signed-off-by: Thomas Wood <thomas.wood at intel.com>
> ---
>  framework/summary.py | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/framework/summary.py b/framework/summary.py
> index 2fc16ce..c1104c3 100644
> --- a/framework/summary.py
> +++ b/framework/summary.py
> @@ -26,6 +26,7 @@ import shutil
>  import collections
>  import tempfile
>  from mako.template import Template
> +from datetime import timedelta

Imports should be ordered buitlins, 3rd party modules, then local modules.
Move datetime before mako.template

> 
>  # a local variable status exists, prevent accidental overloading by
> renaming # the module
> @@ -379,7 +380,7 @@ class Summary:
> 
>              with open(path.join(destination, each.name, "index.html"), 'w')
> as out: out.write(testindex.render(name=each.name,
> -                                           time=each.time_elapsed,
> +                                  time=str(timedelta(0,each.time_elapsed)),

Please add a space after the comma.

>                                             options=each.options,
>                                             glxinfo=each.glxinfo,
>                                             lspci=each.lspci))
> @@ -401,6 +402,7 @@ class Summary:
> 
>                      with open(path.join(destination, each.name, key +
> ".html"), 'w') as out:
> +                        time=value.get('time', 'None')

operators should have spaces between them unless they are keyword declarations 
in functions. So this should be: time = value.get('time', 'None')

>                          out.write(testfile.render(
>                              testname=key,
>                              status=value.get('result', 'None'),
> @@ -410,7 +412,7 @@ class Summary:
>                              # disapear at somepoint
>                              env=value.get('environment', None),
>                              returncode=value.get('returncode', 'None'),
> -                            time=value.get('time', 'None'),
> +                            time=time if time == 'None' else
> str(timedelta(0, time)), info=value.get('info', 'None'),

I'm really not a fan of this, but I don't see any better way to do it, maybe 
someone else will.

>                              traceback=value.get('traceback', 'None'),
>                              command=value.get('command', 'None'),

With those changes, this patch is:
Reviewed-by: Dylan Baker <baker.dylan.c at gmail.com>
-------------- 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/20140224/21433c7a/attachment.pgp>


More information about the Piglit mailing list