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

Dylan Baker baker.dylan.c at gmail.com
Wed Sep 17 14:36:09 PDT 2014


On Tuesday, September 16, 2014 06:12:01 PM Ilia Mirkin wrote:
> 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.

You're right of course, although that is a lot more work :)

> 
> > 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20140917/22ccc330/attachment.sig>


More information about the Piglit mailing list