[Piglit] [PATCH 8/9] framework/exectest.py: use grouping parens instead of \ to break strings

Ilia Mirkin imirkin at alum.mit.edu
Wed Apr 9 18:58:47 PDT 2014


On Wed, Apr 9, 2014 at 9:27 PM, Dylan Baker <baker.dylan.c at gmail.com> wrote:
> ---
>  framework/exectest.py | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/framework/exectest.py b/framework/exectest.py
> index 72061e0..76f9be8 100644
> --- a/framework/exectest.py
> +++ b/framework/exectest.py
> @@ -90,15 +90,15 @@ class Test(object):
>                  if not isinstance(result, TestResult):
>                      result = TestResult(result)
>                      result['result'] = 'warn'
> -                    result['note'] = 'Result not returned as an instance ' \
> -                                     'of TestResult'
> +                    result['note'] = ('Result not returned as an instance '
> +                                      'of TestResult')
>              except:
>                  result = TestResult()
>                  result['result'] = 'fail'
> -                result['exception'] = str(sys.exc_info()[0]) + \
> -                    str(sys.exc_info()[1])
> -                result['traceback'] = \
> -                    "".join(traceback.format_tb(sys.exc_info()[2]))
> +                result['exception'] = (str(sys.exc_info()[0]) +
> +                                       str(sys.exc_info()[1]))

Alternatively, "{}{}".format(*sys.exc_info()[:2])

[OK, that didn't turn out as pretty as I had hoped -- "".join wants
strings, and I guess the way-more-readable "%s%s" % foo syntax is
going out of style :( ]

> +                result['traceback'] = "".join(
> +                    traceback.format_tb(sys.exc_info()[2]))
>
>              log.log(path, result['result'])
>              log.post_log(log_current, result['result'])
> @@ -251,8 +251,8 @@ class Test(object):
>              # Piglit should not report that test as having
>              # failed.
>              if e.errno == errno.ENOENT:
> -                out = "PIGLIT: {'result': 'skip'}\n" \
> -                    + "Test executable not found.\n"
> +                out = ("PIGLIT: {'result': 'skip'}\n"
> +                       "Test executable not found.\n")
>                  err = ""
>                  returncode = None
>              else:
> --
> 1.9.1
>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit


More information about the Piglit mailing list