On Tuesday, April 15, 2014 20:07:00 Ilia Mirkin wrote:
> On Tue, Apr 15, 2014 at 7:12 PM, Dylan Baker
<[email protected]> wrote:
> > This uses a for loop instead of an incrementing while loop. This might
> > be slightly faster since xrange() doesn't do arithmetic, but the big
> > advantage is less code and it's easier to read.
> >
> > Signed-off-by: Dylan Baker <[email protected]>
> > ---
> >
> >  framework/exectest.py | 9 ++-------
> >  1 file changed, 2 insertions(+), 7 deletions(-)
> >
> > diff --git a/framework/exectest.py b/framework/exectest.py
> > index effe12e..8d1dbbf 100644
> > --- a/framework/exectest.py
> > +++ b/framework/exectest.py
> >
> > @@ -154,18 +154,13 @@ class Test(object):
> >                  results['returncode'] = None
> >                  return results
> >
> > -            i = 0
> > -            while True:
> >
> > +            for _ in xrange(5):
> >                  out, err, returncode = self.get_command_result()
> >
> >                  # https://bugzilla.gnome.org/show_bug.cgi?idh0214 is
> >                  # affecting many developers.  If we catch it
> >                  # happening, try just re-running the test.
> >
> > -                if out.find("Got spurious window resize") >= 0:
> > -                    i = i + 1
> > -                    if i >= 5:
> > -                        break
> > -                else:
>
> > +                if out.find("Got spurious window resize") == -1:
> While on the subject of simplification, how about
>
> if "Got spurious window resize" not in out:
>   break

Good call. I'll do that.

>
> >                      break
> >
> >              results['result'] = 'fail'
> >
> > --
> > 1.9.2
> >
> > _______________________________________________
> > Piglit mailing list
> > [email protected]
> > http://lists.freedesktop.org/mailman/listinfo/piglit

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
Piglit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to