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?id=680214 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:
                     break
 
             results['result'] = 'fail'
-- 
1.9.2

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

Reply via email to