[Piglit] [PATCH 3/4] framework/summary.py: move text summary printer into a helper

Dylan Baker baker.dylan.c at gmail.com
Mon May 11 15:32:43 PDT 2015


On Mon, May 11, 2015 at 06:00:41PM -0400, Ilia Mirkin wrote:
> On Mon, May 11, 2015 at 5:57 PM, Dylan Baker <baker.dylan.c at gmail.com> wrote:

[snip]

> > +        def print_summary():
> > +            """print a summary."""
> > +            print("summary:\n"
> > +                  "       pass: {pass}\n"
> > +                  "       fail: {fail}\n"
> > +                  "      crash: {crash}\n"
> > +                  "       skip: {skip}\n"
> > +                  "    timeout: {timeout}\n"
> > +                  "       warn: {warn}\n"
> > +                  " incomplete: {incomplete}\n"
> > +                  " dmesg-warn: {dmesg-warn}\n"
> > +                  " dmesg-fail: {dmesg-fail}".format(**self.totals))
> > +            if self.tests['changes']:
> 
> I never know how these inner functions work... can you confirm that
> 'self' points to the right thing with this?

Functions defined inside functions are closures, with access to all of
the variables in the scope they are defined in.

I can confirm that piglit summary console -s <my result> does the right
thing.

[snip]
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20150511/849d2fd9/attachment.sig>


More information about the Piglit mailing list