[Piglit] [PATCH 3/3] framework/log.py: bugfix: logger recives status object

Ilia Mirkin imirkin at alum.mit.edu
Tue Sep 16 15:12:01 PDT 2014


On Tue, Sep 16, 2014 at 5:46 PM, Dylan Baker <baker.dylan.c at gmail.com> wrote:
> In the event that a test does not reach the point of returning a status
> either via interpret_result() or by an early return, the result passed
> to the logger will be the default, which is a Status object. This would

Sounds like the default shouldn't be a status object then... dealing
with different object types for no good reason seems silly.

> cause an assertion to be triggered that the status was not in the list
> of accepted statuses.
>
> This patch corrects this by explicitly transforming the status into a
> str (via the str() method).
>
> Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
> ---
>  framework/log.py | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/framework/log.py b/framework/log.py
> index e0f8cf6..4575707 100644
> --- a/framework/log.py
> +++ b/framework/log.py
> @@ -117,6 +117,8 @@ class Log(object):
>          # increment the number of completed tests
>          self.__complete += 1
>
> +        # In some cases result can be a framework.status.Status() instance
> +        result = str(result)
>          assert result in self.__summary_keys, 'Result "{0}" not in {1}'.format(
>              result, self.__summary_keys)
>          self.__summary[result] += 1
> @@ -129,6 +131,8 @@ class Log(object):
>          over it.
>
>          """
> +        # In some cases result can be a framework.status.Status() instance
> +        result = str(result)
>          assert result in self.__summary_keys, 'Result "{0}" not in {1}'.format(
>              result, self.__summary_keys)
>          self.__print(name, result)
> --
> 2.1.0
>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit


More information about the Piglit mailing list