[IMP] style
authorXavier Morel <xmo@openerp.com>
Wed, 19 Feb 2014 10:13:34 +0000 (11:13 +0100)
committerXavier Morel <xmo@openerp.com>
Wed, 19 Feb 2014 10:13:34 +0000 (11:13 +0100)
use break instead of return so cleanup can eventually be put after loop if necessary (?)

bzr revid: xmo@openerp.com-20140219101334-n8fcmzxptrqj717a

openerp/tests/common.py

index 7041206..901f0d9 100644 (file)
@@ -189,7 +189,7 @@ class HttpCase(TransactionCase):
         """
         t0 = time.time()
         buf = bytearray()
-        while 1:
+        while True:
             # timeout
             self.assertLess(time.time(), t0 + timeout,
                 "PhantomJS tests should take less than %s seconds" % timeout)
@@ -203,16 +203,15 @@ class HttpCase(TransactionCase):
 
             if ready:
                 s = phantom.stdout.read(1)
-                if s:
-                    buf.append(s)
-                else:
+                if not s:
                     break
+                buf.append(s)
 
             # process lines
             if '\n' in buf:
                 line, buf = buf.split('\n', 1)
                 if line == "ok":
-                    return
+                    break
                 if line.startswith("error"):
                     # 'error $message' or use generic message
                     self.fail(line[6:] or "phantomjs test failed")