[IMP] style
use break instead of return so cleanup can eventually be put after loop if necessary (?) bzr revid: xmo@openerp.com-20140219101334-n8fcmzxptrqj717a
This commit is contained in:
parent
abb58ee3b8
commit
fbead8fab1
|
@ -189,7 +189,7 @@ class HttpCase(TransactionCase):
|
||||||
"""
|
"""
|
||||||
t0 = time.time()
|
t0 = time.time()
|
||||||
buf = bytearray()
|
buf = bytearray()
|
||||||
while 1:
|
while True:
|
||||||
# timeout
|
# timeout
|
||||||
self.assertLess(time.time(), t0 + timeout,
|
self.assertLess(time.time(), t0 + timeout,
|
||||||
"PhantomJS tests should take less than %s seconds" % timeout)
|
"PhantomJS tests should take less than %s seconds" % timeout)
|
||||||
|
@ -203,16 +203,15 @@ class HttpCase(TransactionCase):
|
||||||
|
|
||||||
if ready:
|
if ready:
|
||||||
s = phantom.stdout.read(1)
|
s = phantom.stdout.read(1)
|
||||||
if s:
|
if not s:
|
||||||
buf.append(s)
|
|
||||||
else:
|
|
||||||
break
|
break
|
||||||
|
buf.append(s)
|
||||||
|
|
||||||
# process lines
|
# process lines
|
||||||
if '\n' in buf:
|
if '\n' in buf:
|
||||||
line, buf = buf.split('\n', 1)
|
line, buf = buf.split('\n', 1)
|
||||||
if line == "ok":
|
if line == "ok":
|
||||||
return
|
break
|
||||||
if line.startswith("error"):
|
if line.startswith("error"):
|
||||||
# 'error $message' or use generic message
|
# 'error $message' or use generic message
|
||||||
self.fail(line[6:] or "phantomjs test failed")
|
self.fail(line[6:] or "phantomjs test failed")
|
||||||
|
|
Loading…
Reference in New Issue