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.

v2: - use 'x in str' instead of str.find()

Signed-off-by: Dylan Baker <[email protected]>
---
 framework/exectest.py | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/framework/exectest.py b/framework/exectest.py
index 5e13d35..ae751ff 100644
--- a/framework/exectest.py
+++ b/framework/exectest.py
@@ -154,18 +154,11 @@ class Test(object):
             results['returncode'] = None
             return results
 
-        i = 0
-        while True:
+        # https://bugzilla.gnome.org/show_bug.cgi?id=680214 is affecting many
+        # developers. If we catch it happening, try just re-running the test.
+        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 "Got spurious window resize" not in out:
                 break
 
         results['result'] = 'fail'
-- 
1.9.2

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

Reply via email to